***************************************************************************/
/* sort en affichant une erreur */
-function cb_erreur($text) {
+function cb_erreur($text, $conf_title="") {
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));
+ $content = "raison de l'erreur : " . $text . "\n";
+ if ($conf_title != "") {
+ $content = $content."paiement : ".$conf_title."\n";
+ }
+ $content = $content . "dump de REQUEST :\n" . var_export($_REQUEST, true);
+ $mymail->setTxtBody($content);
$mymail->send();
echo "Notification sent.\n";
exit;
$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);
'payment' => $this->make_hook('payment', AUTH_PUBLIC, 'user'),
'payment/cyber2_return' => $this->make_hook('cyber2_return', AUTH_PUBLIC, 'user', NO_HTTPS),
'payment/paypal_return' => $this->make_hook('paypal_return', AUTH_PUBLIC, 'user', NO_HTTPS),
- '%grp/paiement' => $this->make_hook('xnet_payment', AUTH_PASSWD, 'user'),
- '%grp/payment' => $this->make_hook('xnet_payment', AUTH_PASSWD, 'user'),
+ '%grp/paiement' => $this->make_hook('xnet_payment', AUTH_PUBLIC, 'user'),
+ '%grp/payment' => $this->make_hook('xnet_payment', AUTH_PUBLIC, 'user'),
'%grp/payment/csv' => $this->make_hook('payment_csv', AUTH_PASSWD, 'groupadmin'),
'%grp/payment/cyber2_return' => $this->make_hook('cyber2_return', AUTH_PUBLIC, 'user', NO_HTTPS),
'%grp/payment/paypal_return' => $this->make_hook('paypal_return', AUTH_PUBLIC, 'user', NO_HTTPS),
$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) {
} else {
$pay->init($val, $meth);
$pay->prepareform($user);
+ $page->assign('full_name', $user->fullName(true));
$page->assign('sex', $user->isFemale());
}
} elseif (S::logged()) {
/* on extrait le code de retour */
if (Env::v('vads_result') != '00') {
- cb_erreur('erreur lors du paiement : ?? (' . Env::v('vads_result') . ')');
+ cb_erreur('erreur lors du paiement : ?? (' . Env::v('vads_result') . ')', $conf_title);
}
/* on fait l'insertion en base de donnees */
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 */
$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);
}
global $globals;
$perms = S::v('perms');
- if (!$perms->hasFlag('groupmember')) {
+ if (!(S::identified() && $perms->hasFlag('groupmember'))) {
if (is_null($pid)) {
return PL_FORBIDDEN;
}
INNER JOIN group_event_participants AS ep ON (ep.eid = e.eid AND ep.uid = {?})
WHERE e.paiement_id = {?} AND e.asso_id = {?}",
S::i('uid'), $pid, $globals->asso('id'));
- if ($res->numRows() == 0) {
+ $public = XDB::query("SELECT 1
+ FROM payments AS p
+ INNER JOIN group_events AS g ON (g.paiement_id = p.id)
+ WHERE g.asso_id = {?} AND p.id = {?} AND FIND_IN_SET('public', p.flags)",
+ $globals->asso('id'), $pid);
+ if ($res->numRows() == 0 && $public->numRows() == 0) {
return PL_FORBIDDEN;
}
}
$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');
$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;
$table_editor->describe('amount_max', 'montant maximum', false, true);
$table_editor->describe('mail', 'email contact', true);
$table_editor->describe('confirmation', 'message confirmation', false, true);
-
+ $table_editor->describe('rib_id', 'RIB', false, true);
// adds a column with the start date of the linked event if there is one
$table_editor->add_option_table('group_events', 'group_events.paiement_id = t.id');
- $table_editor->add_option_field('group_events.debut', 'related_event', 'évènement', 'timestamp');
+ $table_editor->add_option_field('group_events.archive', 'related_event', 'évènement archivé ?', 'tinyint');
+ // adds a column with the linked rib if there is one
+ $table_editor->add_option_table('payment_bankaccounts', 'payment_bankaccounts.id = t.rib_id');
+ $table_editor->add_option_field('payment_bankaccounts.owner', 'linked_rib_owner', 'rib associé', 'varchar');
$table_editor->apply($page, $action, $id);
}
$recongp['id']);
$recongp['recons'] = $res->fetchAllAssoc();
- $res = XDB::query('SELECT id, payment_id, amount, account_id, message, date
- FROM payment_transfers
+ $res = XDB::query('SELECT t.id, t.payment_id, t.amount, b.owner, t.message, t.date
+ FROM payment_transfers AS t
+ LEFT JOIN payment_bankaccounts AS b ON (t.account_id=b.id)
WHERE recongroup_id = {?}',
$recongp['id']);
$recongp['transfers'] = $res->fetchAllAssoc();
// create transfers
XDB::execute('INSERT INTO payment_transfers
- SELECT NULL, {?}, t.ref, SUM(t.amount+t.commission), NULL, p.text, NULL
+ SELECT NULL, {?}, t.ref, SUM(t.amount+t.commission), p.rib_id, p.text, NULL
FROM payment_transactions AS t
LEFT JOIN payments AS p ON (t.ref = p.id)
LEFT JOIN groups AS g ON (p.asso_id = g.id)
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'