X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;f=include%2Fvalidations%2Fpaiements.inc.php;h=250980620411e8f7b44b8aebcdd373c9fe7f3da9;hb=15b9758d68d315d2600af1741b36b44efe3b2cef;hp=406dfbf5267e80ab44c84c79cd56a50b247bc97c;hpb=4abb0fe4bcefc73a18891e9768640d8811a09acc;p=platal.git diff --git a/include/validations/paiements.inc.php b/include/validations/paiements.inc.php index 406dfbf..2509806 100644 --- a/include/validations/paiements.inc.php +++ b/include/validations/paiements.inc.php @@ -1,6 +1,6 @@ msg_reponse = $_msg; $this->asso_id = (string)$_asso_id; $this->evt = (string)$_evt; + $this->donation = $_donation; $this->montant = $_montant; $this->montant_min = $_montantmin; $this->montant_max = $_montantmax; @@ -154,9 +156,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."; } } @@ -167,14 +169,11 @@ Si le télépaiement n'est pas lié à un groupe ou supérieur à 51 euros, lais { $res = XDB::query("SELECT MAX(id) FROM payments"); $id = $res->fetchOneCell()+1; - $ret = XDB::execute("INSERT INTO payments VALUES - ( {?}, {?}, {?}, '', - {?}, {?}, {?}, - {?}, {?}, {?} ) - ", - $id, $this->titre, $this->site, - $this->montant, $this->montant_min, $this->montant_max, - $this->user->bestEmail(), $this->msg_reponse, $this->asso_id); + $flags = ($this->donation ? 'donation' : ''); + $ret = XDB::execute('INSERT INTO payments (id, text, url, flags, amount_def, amount_min, amount_max, mail, confirmation, asso_id) + VALUES ({?}, {?}, {?}, {?}, {?}, {?}, {?}, {?}, {?}, {?})', + $id, $this->titre, $this->site, $flags, $this->montant, $this->montant_min, + $this->montant_max, $this->user->bestEmail(), $this->msg_reponse, $this->asso_id); if ($this->asso_id && $this->evt) { XDB::execute("UPDATE group_events SET paiement_id = {?} @@ -188,25 +187,20 @@ Si le télépaiement n'est pas lié à un groupe ou supérieur à 51 euros, lais list($nom, $diminutif, $evt) = $res->fetchOneRow(); require_once dirname(__FILE__) . '/../../modules/xnetevents/xnetevents.inc.php'; $participants = get_event_participants(get_event_detail($this->evt, false, $this->asso_id), null); - foreach ($participants as &$u) { + foreach ($participants as $u) { if (!$u['notify_payment']) { continue; } $topay = $u['montant'] - $u['paid']; if ($topay > 0) { $mailer = new PlMailer('xnetevents/newpayment.mail.tpl'); + $mailer->addTo($u['user']); $mailer->assign('asso', $nom); $mailer->assign('diminutif', $diminutif); $mailer->assign('evt', $evt); $mailer->assign('payment', $id); - $mailer->assign('prenom', $u['prenom']); + $mailer->assign('prenom', $u['user']->firstName()); $mailer->assign('topay', $topay); - - if (strpos($u['email'], '@') === false) { - $mailer->assign('to', $u['email'] . '@' . $globals->mail->domain); - } else { - $mailer->assign('to', $u['email']); - } $mailer->send(); } }