X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;f=modules%2Fpayment.php;h=bfaa5ec388369cfd7450e2a2367a1877b7c482b2;hb=905cda00459649fa751c2ea292e079f5f05cae81;hp=f6669bd6b7a4520417410830d2c2b5724f2fe9ef;hpb=243cdb7b0cefff168039e1fc9c112cebdcdd53e7;p=platal.git diff --git a/modules/payment.php b/modules/payment.php index f6669bd..bfaa5ec 100644 --- a/modules/payment.php +++ b/modules/payment.php @@ -299,7 +299,7 @@ class PaymentModule extends PLModule //} /* on extrait les informations sur l'utilisateur */ - $user = User::get(Env::v('vads_cust_id')); + $user = User::get(Env::i('vads_cust_id')); if (!$user) { cb_erreur("uid invalide"); } @@ -312,16 +312,18 @@ class PaymentModule extends PLModule $ref = $matches[1]; $res = XDB::query('SELECT mail, text, confirmation FROM payments - WHERE id = {?}', $ref); - if (!list($conf_mail, $conf_title, $conf_text) = $res->fetchOneRow()) { + WHERE id={?}", $ref); + if ($res->numRows() != 1) { cb_erreur("référence de commande inconnue"); } + list($conf_mail, $conf_title, $conf_text) = $res->fetchOneRow(); /* on extrait le montant */ if (Env::v('vads_currency') != '978') { cb_erreur("monnaie autre que l'euro"); } - $montant = sprintf("%.02f", ((float)Env::v('vads_amount')) / 100) . ' EUR'; + $amount = ((float)Env::i('vads_amount')) / 100; + $montant = sprintf("%.02f EUR", $amount); /* on extrait le code de retour */ if (Env::v('vads_result') != '00') { @@ -335,18 +337,19 @@ class PaymentModule extends PLModule echo "Paiement stored.\n"; // We check if it is an Xnet payment and then update the related ML. - $res = XDB::query('SELECT eid + $res = XDB::query('SELECT eid, asso_id FROM group_events WHERE paiement_id = {?}', $ref); - if ($eid = $res->fetchOneCell()) { + if ($res->numRows() == 1) { + list($eid, $asso_id) = $res->fetchOneRow(); require_once dirname(__FILE__) . '/xnetevents/xnetevents.inc.php'; - $evt = get_event_detail($eid); - subscribe_lists_event($user->id(), $evt, 1, $montant, true); + $evt = get_event_detail($eid, false, $asso_id); + subscribe_lists_event($user->id(), $evt, 1, $amount, true); } /* on genere le mail de confirmation */ $conf_text = str_replace( - array('', '', '', '', '', '', 'comment>'), + array('', '', '', '', '', '', ''), array($user->firstName(), $user->lastName(), $user->promo(), $montant, $user->isFemale() ? 'Chère' : 'Cher', $user->isFemale() ? 'Chère' : 'Cher', Env::v('comment')), $conf_text);