From: Stéphane Jacob Date: Sun, 10 Apr 2011 18:49:18 +0000 (+0200) Subject: Uses more formal language for outsiders requests validations. X-Git-Tag: xorg/1.1.1~109 X-Git-Url: http://git.polytechnique.org/?a=commitdiff_plain;h=a392390935dc54af4523011a9c3d69ceeda35f2c;p=platal.git Uses more formal language for outsiders requests validations. Signed-off-by: Stéphane Jacob --- diff --git a/include/validations.inc.php b/include/validations.inc.php index 7c87d4c..eb2cd4c 100644 --- a/include/validations.inc.php +++ b/include/validations.inc.php @@ -31,6 +31,7 @@ abstract class Validate // {{{ properties public $user; + public $formal; public $stamp; public $unique; @@ -56,6 +57,7 @@ abstract class Validate public function __construct(User $_user, $_unique, $_type) { $this->user = &$_user; + $this->formal = !$this->user->hasProfile(); $this->stamp = date('YmdHis'); $this->unique = $_unique; $this->type = $_type; @@ -221,8 +223,13 @@ abstract class Validate $mailer->addTo("\"{$this->user->fullName()}\" <{$this->user->bestEmail()}>"); $mailer->addCc("validation+{$this->type}@{$globals->mail->domain}"); - $body = ($this->user->isFemale() ? "Chère camarade,\n\n" : "Cher camarade,\n\n") - . $this->_mail_body($isok) + // If the user has no profile, we should be more formal as if she has one. + if ($this->formal) { + $body = ($this->user->isFemale() ? 'Bonjour Madame' : 'Bonjour Monsieur'); + } else { + $body = ($this->user->isFemale() ? 'Chère camarade' : 'Cher camarade'); + } + $body .= ",\n\n" . $this->_mail_body($isok) . (Env::has('comm') ? "\n\n" . Env::v('comm') : '') . "\n\nCordialement,\n-- \nL'équipe de Polytechnique.org\n" . $this->_mail_ps($isok); diff --git a/include/validations/broken.inc.php b/include/validations/broken.inc.php index 70d02bd..2cb486d 100644 --- a/include/validations/broken.inc.php +++ b/include/validations/broken.inc.php @@ -66,15 +66,16 @@ class BrokenReq extends Validate protected function _mail_body($isok) { + $your = ($this->formal ? 'votre' : 'ta'); if ($isok && !$this->m_reactive) { return " Un email de contact vient d'être envoyé à {$this->m_user->fullName()}" . " ({$this->m_user->promo()}) pour confirmer sa volonté de" . " mettre à jour sa redirection Polytechnique.org !\n\n" - . "Merci de ta participation !\n"; + . "Merci de $your participation !\n"; } elseif ($isok) { return " L'adresse de redirection {$this->m_email} de {$this->m_user->fullName()} ({$this->m_user->promo()}) " ."vient d'être réactivée. Un email lui a été envoyé pour l'en informer.\n\n" - ."Merci de ta participation !\n"; + ."Merci de $your participation !\n"; } else { return " Nous n'utiliserons pas cette adresse pour contacter {$this->m_user->fullName()} ({$this->m_user->promo()})."; } diff --git a/include/validations/evts.inc.php b/include/validations/evts.inc.php index 67076a0..7dcbce0 100644 --- a/include/validations/evts.inc.php +++ b/include/validations/evts.inc.php @@ -122,10 +122,11 @@ class EvtReq extends Validate protected function _mail_body($isok) { + $you_have = ($this->formal ? 'vous aviez' : 'tu avais'); if ($isok) { - return " L'annonce que tu avais proposée ({$this->titre}) vient d'être validée."; + return " L'annonce que $you_have proposée ({$this->titre}) vient d'être validée."; } else { - return " L'annonce que tu avais proposée ({$this->titre}) a été refusée."; + return " L'annonce que $you_have proposée ({$this->titre}) a été refusée."; } } diff --git a/include/validations/marketing.inc.php b/include/validations/marketing.inc.php index 9154526..6915606 100644 --- a/include/validations/marketing.inc.php +++ b/include/validations/marketing.inc.php @@ -79,12 +79,14 @@ class MarkReq extends Validate protected function _mail_body($isok) { + $your1 = ($this->formal ? 'votre' : 'ton'); + $your2 = ($this->formal ? 'votre' : 'ta'); if ($isok) { return " Un email de marketing vient d'être envoyé " - . ($this->perso ? 'en ton nom' : 'en notre nom') + . ($this->perso ? "en $your1 nom" : 'en notre nom') . " à {$this->m_user->fullName()} ({$this->m_user->promo()}) " . "pour l'encourager à s'inscrire !\n\n" - . "Merci de ta participation !\n"; + . "Merci de $your2 participation !\n"; } else { return " Nous n'avons pas jugé bon d'envoyer d'email de marketing à " . "{$this->m_user->fullName()} ({$this->m_user->promo()})."; diff --git a/include/validations/nl.inc.php b/include/validations/nl.inc.php index 8361cc6..728bf38 100644 --- a/include/validations/nl.inc.php +++ b/include/validations/nl.inc.php @@ -79,10 +79,11 @@ class NLReq extends Validate protected function _mail_body($isok) { + $you_have = ($this->formal ? 'vous aviez' : 'tu avais'); if ($isok) { - return " L'article que tu avais proposé (" . $this->art->title() . ") vient d'être validé."; + return " L'article que $you_have proposé (" . $this->art->title() . ") vient d'être validé."; } else { - return " L'article que tu avais proposé a été refusé."; + return " L'article que $you_have proposé a été refusé."; } } diff --git a/include/validations/paiements.inc.php b/include/validations/paiements.inc.php index 83e2689..afbead3 100644 --- a/include/validations/paiements.inc.php +++ b/include/validations/paiements.inc.php @@ -154,9 +154,9 @@ Si le télépaiement n'est pas lié à un groupe ou supérieur à 51 euros, lais protected function _mail_body($isok) { if ($isok) { - return " Le paiement que tu avais demandé pour {$this->titre} vient d'être créé.".($this->evt?" Il a bien été associé à la gestion de l'événement du groupe":""); + return " Le paiement demandé pour {$this->titre} vient d'être créé.".($this->evt?" Il a bien été associé à la gestion de l'événement du groupe":""); } else { - return " La demande que tu avais faite pour le paiement de {$this->intitule} a été refusée."; + return " La demande faite pour le paiement de {$this->intitule} a été refusée."; } } diff --git a/include/validations/surveys.inc.php b/include/validations/surveys.inc.php index e4f7d8e..e2ca7a1 100644 --- a/include/validations/surveys.inc.php +++ b/include/validations/surveys.inc.php @@ -65,10 +65,11 @@ class SurveyReq extends Validate protected function _mail_body($isok) { + $you_have = ($this->formal ? 'vous aviez' : 'tu avais'); if ($isok) { - return " Le sondage que tu avais proposé vient d'être validé."; + return " Le sondage que $you_have proposé vient d'être validé."; } else { - return " Le sondage que tu avais proposé a été refusé."; + return " Le sondage que $you_have proposé a été refusé."; } }