<?php
/***************************************************************************
- * Copyright (C) 2003-2009 Polytechnique.org *
+ * Copyright (C) 2003-2010 Polytechnique.org *
* http://opensource.polytechnique.org/ *
* *
* This program is free software; you can redistribute it and/or modify *
return PL_NOT_FOUND;
}
$res = XDB::query("SELECT asso_id
- FROM paiement.paiements
+ FROM payments
WHERE asso_id = {?} AND id = {?}",
$globals->asso('id'), $ref);
if (!$res->numRows()) {
$pay->init($val, $meth);
$pay->prepareform($pay);
} else {
- $res = XDB::iterator("SELECT timestamp, montant
- FROM paiement.transactions
+ $res = XDB::iterator("SELECT timestamp, amount
+ FROM payment_transactions
WHERE uid = {?} AND ref = {?}
ORDER BY timestamp DESC",
S::v('uid', -1), $ref);
echo ($ref = $matches[1]);
$res = XDB::query("SELECT mail, text, confirmation
- FROM paiement.paiements
+ FROM payments
WHERE id={?}", $ref);
if (!list($conf_mail, $conf_title, $conf_text) = $res->fetchOneRow()) {
cb_erreur("référence de commande inconnue");
/* on extrait le code de retour */
if ($champ906 != "0000") {
$res = XDB::query('SELECT rcb.text, c.id, c.text
- FROM paiement.codeRCB AS rcb
- LEFT JOIN paiement.codeC AS c ON (rcb.codeC = c.id)
+ FROM payment_codeRCB AS rcb
+ LEFT JOIN payment_codeC AS c ON (rcb.codeC = c.id)
WHERE rcb.id = {?}', $champ906);
if (list($rcb_text, $c_id, $c_text) = $res->fetchOneRow()) {
cb_erreur("erreur lors du paiement : $c_text ($c_id)");
}
/* on fait l'insertion en base de donnees */
- XDB::execute("INSERT INTO paiement.transactions (id, uid, ref, fullref, montant, cle, comment)
+ XDB::execute("INSERT INTO payment_transactions (id, uid, ref, fullref, amount, pkey, comment)
VALUES ({?}, {?}, {?}, {?}, {?}, {?}, {?})",
$champ901, $user->id(), $ref, $champ200, $montant, $champ905, Env::v('comment'));
// We check if it is an Xnet payment and then update the related ML.
$res = XDB::query('SELECT eid
- FROM groupex.evenements
+ FROM group_events
WHERE paiement_id = {?}', $ref);
if ($eid = $res->fetchOneCell()) {
- $this->load('xnetevents.inc.php');
+ require_once dirname(__FILE__) . '/xnetevents/xnetevents.inc.php';
$evt = get_event_detail($eid);
subscribe_lists_event(0, $uid, $evt, $montant, true);
}
$ref = $matches[1];
$res = XDB::query("SELECT mail, text, confirmation
- FROM paiement.paiements
+ FROM payments
WHERE id = {?}", $ref);
if (!list($conf_mail,$conf_title,$conf_text) = $res->fetchOneRow()) {
paypal_erreur("référence de commande inconnue");
}
/* on fait l'insertion en base de donnees */
- XDB::execute("INSERT INTO paiement.transactions (id, uid, ref, fullref, montant, cle, comment)
+ XDB::execute("INSERT INTO payment_transactions (id, uid, ref, fullref, amount, pkey, comment)
VALUES ({?}, {?}, {?}, {?}, {?}, {?}, {?})",
$no_transaction, $user->id(), $ref, $fullref, $montant, $clef, Env::v('comment'));
// We check if it is an Xnet payment and then update the related ML.
$res = XDB::query('SELECT eid
- FROM groupex.evenements
+ FROM group_events
WHERE paiement_id = {?}', $ref);
if ($eid = $res->fetchOneCell()) {
- $this->load('xnetevents.inc.php');
+ require_once dirname(__FILE__) . '/xnetevents/xnetevents.inc.php';
$evt = get_event_detail($eid);
subscribe_lists_event(0, $uid, $evt, $montant, true);
}
return PL_FORBIDDEN;
}
$res = XDB::query("SELECT 1
- FROM groupex.evenements AS e
- INNER JOIN groupex.evenements_participants AS ep ON (ep.eid = e.eid AND uid = {?})
+ FROM group_events AS e
+ INNER JOIN group_event_participants AS ep ON (ep.eid = e.eid AND uid = {?})
WHERE e.paiement_id = {?} AND e.asso_id = {?}",
S::i('uid'), $pid, $globals->asso('id'));
if ($res->numRows() == 0) {
'montant' => strtr($sum, '.', ',').' €');
}
$res = XDB::iterRow("SELECT e.eid, e.short_name, e.intitule, ep.nb, ei.montant, ep.paid
- FROM groupex.evenements AS e
- LEFT JOIN groupex.evenements_participants AS ep ON (ep.eid = e.eid AND uid = {?})
- INNER JOIN groupex.evenements_items AS ei ON (ep.eid = ei.eid AND ep.item_id = ei.item_id)
+ FROM group_events AS e
+ LEFT JOIN group_event_participants AS ep ON (ep.eid = e.eid AND uid = {?})
+ INNER JOIN group_event_items AS ei ON (ep.eid = ei.eid AND ep.item_id = ei.item_id)
WHERE e.paiement_id = {?}",
S::v('uid'), $pid);
$event[$pid] = array();
function handler_admin(&$page, $action = 'list', $id = null) {
$page->setTitle('Administration - Paiements');
$page->assign('title', 'Gestion des télépaiements');
- $table_editor = new PLTableEditor('admin/payments','paiement.paiements','id');
- $table_editor->add_join_table('paiement.transactions','ref',true);
+ $table_editor = new PLTableEditor('admin/payments','payments','id');
+ $table_editor->add_join_table('payment_transactions','ref',true);
$table_editor->add_sort_field('flags');
$table_editor->add_sort_field('id', true, true);
- $table_editor->on_delete("UPDATE paiement.paiements SET flags = 'old' WHERE id = {?}", "Le paiement a été archivé");
+ $table_editor->on_delete("UPDATE payments SET flags = 'old' WHERE id = {?}", "Le paiement a été archivé");
$table_editor->describe('text','intitulé',true);
$table_editor->describe('url','site web',false);
- $table_editor->describe('montant_def','montant par défaut',false);
- $table_editor->describe('montant_min','montant minimum',false);
- $table_editor->describe('montant_max','montant maximum',false);
+ $table_editor->describe('amount_def','montant par défaut',false);
+ $table_editor->describe('amount_min','montant minimum',false);
+ $table_editor->describe('amount_max','montant maximum',false);
$table_editor->describe('mail','email contact',true);
$table_editor->describe('confirmation','message confirmation',false);
+
+ // 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->apply($page, $action, $id);
}
}