projects
/
platal.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Payment takes into account the amount when it is given (Closes #1567)
[platal.git]
/
modules
/
payment.php
diff --git
a/modules/payment.php
b/modules/payment.php
index
66c56b2
..
e183dc8
100644
(file)
--- 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.');
}
$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) {
$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);
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, $
amou
nt, true);
+ subscribe_lists_event($user->id(), $evt['short_name'], 1, $
monta
nt, true);
}
/* on genere le mail de confirmation */
}
/* 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.
$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);
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';
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);
}
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()) {
$trans = array();
$event = array();
if (may_update()) {
- static $orders = array('t
imestamp
' => 'p', 'directory_name' => 'a', 'promo' => 'pd', 'comment' => 'p', 'amount' => 'p');
+ static $orders = array('t
s_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');
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;
$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');
$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'];
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(),
($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;
fclose($csv);
exit;