X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;f=modules%2Fpayment.php;h=e183dc89677ea4eaebc522d4bd128de90ed55098;hb=8af607ead9a244d0e83c9312c2c8a946c696d0b6;hp=66c56b239a51eaaf877f61b635688b9da4745e93;hpb=1ea2d001c2511d30bae13fe3aed0e698919380a8;p=platal.git diff --git a/modules/payment.php b/modules/payment.php index 66c56b2..e183dc8 100644 --- a/modules/payment.php +++ b/modules/payment.php @@ -142,6 +142,9 @@ class PaymentModule extends PLModule $page->kill('La transaction selectionnée est périmée.'); } + if (Env::has('montant')) { + $pay->amount_def = Env::v('montant'); + } $val = (Post::v('amount') != 0) ? Post::v('amount') : $pay->amount_def; if (($error = $pay->check($val)) !== true) { @@ -278,7 +281,7 @@ class PaymentModule extends PLModule list($eid, $asso_id) = $res->fetchOneRow(); require_once dirname(__FILE__) . '/xnetevents/xnetevents.inc.php'; $evt = get_event_detail($eid, false, $asso_id); - subscribe_lists_event($user->id(), $evt['short_name'], 1, $amount, true); + subscribe_lists_event($user->id(), $evt['short_name'], 1, $montant, true); } /* on genere le mail de confirmation */ @@ -369,12 +372,13 @@ class PaymentModule extends PLModule $no_transaction, $user->id(), $ref, $fullref, $montant, $clef, Env::v('comment'), Get::i('display')); // 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); + $evt = get_event_detail($eid, false, $asso_id); subscribe_lists_event($user->id(), $evt['short_name'], 1, $montant, true); } @@ -451,7 +455,7 @@ class PaymentModule extends PLModule $trans = array(); $event = array(); if (may_update()) { - static $orders = array('timestamp' => 'p', 'directory_name' => 'a', 'promo' => 'pd', 'comment' => 'p', 'amount' => 'p'); + static $orders = array('ts_confirmed' => 'p', 'directory_name' => 'a', 'promo' => 'pd', 'comment' => 'p', 'amount' => 'p'); if (Get::has('order_id') && Get::has('order') && array_key_exists(Get::v('order'), $orders)) { $order_id = Get::i('order_id'); @@ -544,17 +548,17 @@ class PaymentModule extends PLModule $users = User::getBulkUsersWithUIDs($res, 'uid', 'user'); $sum = 0; - pl_cached_content_headers('text/x-csv', 1); + pl_cached_content_headers('text/x-csv', 'iso-8859-1', 1); $csv = fopen('php://output', 'w'); - fputcsv($csv, array('Date', 'Nom', 'Prénom', 'Sexe', 'Promotion', 'Email', 'Commentaire', 'Montant'), ';'); + fputcsv($csv, array('Date', 'Nom', utf8_decode('Prénom'), 'Sexe', 'Promotion', 'Email', 'Commentaire', 'Montant'), ';'); foreach ($users as $item) { $user = $item['user']; $sum += $item['amount']; - fputcsv($csv, array(format_datetime($item['date'], '%d/%m/%y'), $user->lastName(), $user->firstName(), + fputcsv($csv, array(format_datetime($item['date'], '%d/%m/%y'), utf8_decode($user->lastName()), utf8_decode($user->firstName()), ($user->isFemale()) ? 'F' : 'M', $user->promo(), $user->ForlifeEmail(), - $item['comment'], strtr($item['amount'],'.',',').' €' ), ';'); + utf8_decode($item['comment']), strtr($item['amount'], '.', ',') . ' EUR' ), ';'); } - fputcsv($csv, array(date('d/m/y'), 'Total', '', '', '' , '', '', strtr($sum,'.',',').' €'), ';'); + fputcsv($csv, array(date('d/m/y'), 'Total', '', '', '' , '', '', strtr($sum, '.', ',') . ' EUR'), ';'); fclose($csv); exit;