X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;f=modules%2Fpayment.php;h=623aad2b7389e989611d5760780b06d0a443647a;hb=f7a93ff33f4c2f41702950e9258faa09894afcd1;hp=66c56b239a51eaaf877f61b635688b9da4745e93;hpb=07d0a10adbc2578f9b85875e551a03b99d3650e8;p=platal.git diff --git a/modules/payment.php b/modules/payment.php index 66c56b2..623aad2 100644 --- a/modules/payment.php +++ b/modules/payment.php @@ -22,12 +22,15 @@ /* sort en affichant une erreur */ function cb_erreur($text) { global $globals; - echo "Error.\n"; + echo "Error: ".$text."\n"; $mymail = new PlMailer(); $mymail->addTo($globals->money->email); $mymail->setFrom("webmaster@" . $globals->mail->domain); $mymail->setSubject("erreur lors d'un télépaiement (CyberPaiement)"); - $mymail->setTxtBody("\n\n".var_export($_REQUEST,true)); + $mymail->setTxtBody("raison de l'erreur : ".$text."\n". + "paiement : $conf_title \n\n". + "dump de REQUEST :\n". + var_export($_REQUEST,true)); $mymail->send(); echo "Notification sent.\n"; exit; @@ -45,7 +48,10 @@ function paypal_erreur($text, $send=true) $mymail->addTo($globals->money->email); $mymail->setFrom("webmaster@" . $globals->mail->domain); $mymail->setSubject("erreur lors d'un télépaiement (PayPal)"); - $mymail->setTxtBody("\n\n".var_export($_REQUEST,true)); + $mymail->setTxtBody("raison de l'erreur : ".$text."\n". + "paiement : $conf_title \n\n". + "dump de REQUEST :\n". + var_export($_REQUEST,true)); $mymail->send(); Platal::page()->trigError($text); @@ -142,6 +148,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 +287,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 +378,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 +461,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 +554,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; @@ -956,7 +966,7 @@ class PaymentLogsImporter extends CSVImporter { static public function compute_systempay_commission($line, $key, $relation) { static $EEE_countries = array( - 'France', 'Allemagne', 'Autriche', 'Belgique', 'Bulgarie', 'Chypre', + 'France', 'Allemagne', 'Autriche', 'Belgique', 'Bulgarie', 'Chypre', 'Suisse', 'Danemark', 'Espagne', 'Estonie', 'Finlande', 'Grèce', 'Hongrie', 'Irlande', 'Islande', 'Italie', 'Lettonie', 'Liechtenstein', 'Lituanie', 'Luxembourg', 'Malte', 'Norvège', 'Pays-Bas', 'Pologne', 'Portugal', 'Roumanie', 'Royaume-Uni', 'Slovaquie', 'Slovénie', 'Suède', 'République Tchèque'