X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;f=include%2Fvalidations%2Fmarketing.inc.php;h=3d724d55f59bc77a7f1dd02469dae1498115929d;hb=5b2c99878fc75a6acffb2239e284f2cb1782142c;hp=2f628456bc6cab14b60dbdf3d0f52527d949ccf7;hpb=7f12e3b4113791f3372f11572a205925d7bb6b97;p=platal.git diff --git a/include/validations/marketing.inc.php b/include/validations/marketing.inc.php index 2f62845..3d724d5 100644 --- a/include/validations/marketing.inc.php +++ b/include/validations/marketing.inc.php @@ -1,6 +1,6 @@ m_id = $mark_id; + $this->m_user = &$mark; $this->m_email = $email; $this->perso = $perso; $this->m_type = $type; $this->m_data = $data; - - $res = XDB::query('SELECT u.nom, u.prenom, u.promo - FROM auth_user_md5 AS u - WHERE user_id = {?} - GROUP BY u.user_id', $mark_id); - list ($this->m_nom, $this->m_prenom, $this->m_promo) = $res->fetchOneRow(); } // }}} @@ -64,11 +55,11 @@ class MarkReq extends Validate public function formu() { $res = XDB::query('SELECT IF(MAX(m.last)>p.relance, MAX(m.last), p.relance) - FROM auth_user_md5 AS u - LEFT JOIN register_pending AS p ON p.uid = u.user_id - LEFT JOIN register_marketing AS m ON m.uid = u.user_id - WHERE user_id = {?}', - $this->m_id); + FROM accounts AS a + LEFT JOIN register_pending AS p ON p.uid = a.uid + LEFT JOIN register_marketing AS m ON m.uid = a.uid + WHERE a.uid = {?}', + $this->m_user->id()); $this->m_relance = $res->fetchOneCell(); return 'include/form.valid.mark.tpl'; } @@ -78,7 +69,7 @@ class MarkReq extends Validate protected function _mail_subj() { - return "[Polytechnique.org] Marketing de {$this->m_prenom} {$this->m_nom} ({$this->m_promo})"; + return "[Polytechnique.org] Marketing de {$this->m_user->fullName()} ({$this->m_user->promo()})"; } // }}} @@ -88,11 +79,13 @@ class MarkReq extends Validate { if ($isok) { return " Un email de marketing vient d'être envoyé " - .($this->perso ? 'en ton nom' : 'en notre nom') - ." à {$this->m_prenom} {$this->m_nom} ({$this->m_promo}) pour l'encourager à s'inscrire !\n\n" - ."Merci de ta participation !\n"; + . ($this->perso ? 'en ton nom' : 'en notre nom') + . " à {$this->m_user->fullName()} ({$this->m_user->promo()}) " + . "pour l'encourager à s'inscrire !\n\n" + . "Merci de ta participation !\n"; } else { - return " Nous n'avons pas jugé bon d'envoyer d'email de marketing à {$this->m_prenom} {$this->m_nom} ({$this->m_promo})."; + return " Nous n'avons pas jugé bon d'envoyer d'email de marketing à " + . "{$this->m_user->fullName()} ({$this->m_user->promo()})."; } } @@ -101,7 +94,7 @@ class MarkReq extends Validate public function commit() { - $market = Marketing::get($this->m_id, $this->m_email); + $market = Marketing::get($this->m_user->id(), $this->m_email); if ($market == null) { return false; }