X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;f=include%2Fvalidations%2Fpaiements.inc.php;h=bb3afe49481e18ddb437ddc755883edd46a5d2d0;hb=2553b7686e0678b8e27858a7c377e73ecb410aec;hp=ece966d9afafae0574ca59b0e35265aa925061e5;hpb=a7c29df3b9bf8f3c3b23fec0f1d2feb814cb61fe;p=platal.git diff --git a/include/validations/paiements.inc.php b/include/validations/paiements.inc.php index ece966d..bb3afe4 100644 --- a/include/validations/paiements.inc.php +++ b/include/validations/paiements.inc.php @@ -1,6 +1,6 @@ titre = $_intitule; $this->site = $_site; @@ -86,11 +88,11 @@ class PayReq extends Validate { // no text [AI JMIAJM IJA MIJ] if (preg_match('/\[[-\'"A-Z ]+\]/', $this->msg_reponse)) { - $this->trig("La demande de paiement n'est pas valide. Merci de compléter le texte avant de la soumettre"); + $this->trigError("La demande de paiement n'est pas valide. Merci de compléter le texte avant de la soumettre"); return false; } if (!preg_match('//', $this->msg_reponse)) { - $this->trig("Le demande de paiement ne contient pas la balise obligatoire <montant>"); + $this->trigError("Le demande de paiement ne contient pas la balise obligatoire <montant>"); return false; } return true; @@ -163,7 +165,6 @@ class PayReq extends Validate public function commit() { - global $globals; $res = XDB::query("SELECT MAX(id) FROM paiement.paiements"); $id = $res->fetchOneCell()+1; $ret = XDB::execute("INSERT INTO paiement.paiements VALUES @@ -173,7 +174,7 @@ class PayReq extends Validate ", $id, $this->titre, $this->site, $this->montant, $this->montant_min, $this->montant_max, - $this->bestalias."@".$globals->mail->domain, $this->msg_reponse, $this->asso_id); + $this->user->bestEmail(), $this->msg_reponse, $this->asso_id); if ($this->asso_id && $this->evt) { XDB::execute("UPDATE groupex.evenements SET paiement_id = {?} @@ -185,11 +186,6 @@ class PayReq extends Validate WHERE e.eid = {?}", $this->evt); list($nom, $diminutif, $evt) = $res->fetchOneRow(); - $mailer = new PlMailer('xnetevents/newpayment.mail.tpl'); - $mailer->assign('asso', $nom); - $mailer->assign('diminutif', $diminutif); - $mailer->assign('evt', $evt); - $mailer->assign('payment', $id); require_once dirname(__FILE__) . '/../../modules/xnetevents/xnetevents.inc.php'; $participants = get_event_participants(get_event_detail($this->evt, false, $this->asso_id), null, 'nom'); foreach ($participants as &$u) { @@ -198,6 +194,11 @@ class PayReq extends Validate } $topay = $u['montant'] - $u['paid']; if ($topay > 0) { + $mailer = new PlMailer('xnetevents/newpayment.mail.tpl'); + $mailer->assign('asso', $nom); + $mailer->assign('diminutif', $diminutif); + $mailer->assign('evt', $evt); + $mailer->assign('payment', $id); $mailer->assign('prenom', $u['prenom']); $mailer->assign('topay', $topay); $mailer->assign('to', $u['email']);