'payment' => $this->make_hook('payment', AUTH_MDP),
'payment/cyber_return' => $this->make_hook('cyber_return', AUTH_PUB),
'payment/paypal_return' => $this->make_hook('paypal_return', AUTH_PUB),
+ 'admin/payments' => $this->make_hook('admin', AUTH_MDP, 'admin'),
);
}
global $globals;
require_once 'profil.func.inc.php' ;
- require_once 'money.inc.php' ;
+ require_once dirname(__FILE__).'/payment/money.inc.php' ;
$page->changeTpl('payment/index.tpl');
$page->assign('xorg_title','Polytechnique.org - Télépaiements');
// initialisation
- $op = Env::get('op', 'select');
- $meth = new PayMethod(Env::getInt('methode', -1));
+ $op = Env::v('op', 'select');
+ $meth = new PayMethod(Env::i('methode', -1));
$pay = new Payment($ref);
if($pay->flags->hasflag('old')){
$page->trig("La transaction selectionnée est périmée.");
$pay = new Payment();
}
- $val = Env::get('montant') != 0 ? Env::get('montant') : $pay->montant_def;
+ $val = Env::v('montant') != 0 ? Env::v('montant') : $pay->montant_def;
if (($e = $pay->check($val)) !== true) {
$page->trig($e);
$pay->init($val, $meth);
$pay->prepareform($pay);
} else {
- $res = $globals->xdb->iterator("SELECT timestamp, montant
+ $res = XDB::iterator("SELECT timestamp, montant
FROM paiement.transactions
WHERE uid = {?} AND ref = {?}
ORDER BY timestamp DESC",
- Session::getInt('uid', -1), $ref);
+ S::v('uid', -1), $ref);
if ($res->total()) $page->assign('transactions', $res);
}
$page->assign('pay', $pay);
$page->assign('evtlink', $pay->event());
- $page->assign('prefix',$globals->money->mpay_tprefix);
-
- return PL_OK;
+ $page->assign('prefix', $globals->money->mpay_tprefix);
}
function handler_cyber_return(&$page, $uid = null)
$montant = "$champ201 $champ202";
/* on extrait les informations sur l'utilisateur */
- $res = $globals->xdb->query("
+ $res = XDB::query("
SELECT a.prenom,a.nom,a.promo,l.alias,FIND_IN_SET(a.flags,'femme')
FROM auth_user_md5 AS a
INNER JOIN aliases AS l ON (a.user_id=l.id AND type!='homonyme')
}
echo ($ref = $matches[1]);
- $res = $globals->xdb->query("SELECT mail,text,confirmation
+ $res = XDB::query("SELECT mail,text,confirmation
FROM paiement.paiements 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 = $globals->xdb->query("SELECT rcb.text,c.id,c.text
+ $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
WHERE rcb.id='$champ906'");
}
/* on fait l'insertion en base de donnees */
- $globals->xdb->execute("INSERT INTO paiement.transactions (id,uid,ref,fullref,montant,cle)
+ XDB::execute("INSERT INTO paiement.transactions (id,uid,ref,fullref,montant,cle)
VALUES ({?},{?},{?},{?},{?},{?})",
$champ901, $uid, $ref, $champ200, $montant, $champ905);
function handler_paypal_return(&$page, $uid = null)
{
- global $globals;
-
$page->changeTpl('payment/retour_paypal.tpl');
require_once 'diogenes/diogenes.hermes.inc.php';
}
/* on extrait les informations sur l'utilisateur */
- $res = $globals->xdb->query("
+ $res = XDB::query("
SELECT a.prenom,a.nom,a.promo,l.alias,FIND_IN_SET(a.flags,'femme')
FROM auth_user_md5 AS a
INNER JOIN aliases AS l ON (a.user_id=l.id AND type!='homonyme')
}
$ref = $matches[1];
- $res = $globals->xdb->query("SELECT mail,text,confirmation
+ $res = XDB::query("SELECT mail,text,confirmation
FROM paiement.paiements 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 */
- $globals->xdb->execute("INSERT INTO paiement.transactions (id,uid,ref,fullref,montant,cle)
+ XDB::execute("INSERT INTO paiement.transactions (id,uid,ref,fullref,montant,cle)
VALUES ({?},{?},{?},{?},{?},{?})",
$no_transaction, $uid, $ref, $fullref, $montant, $clef);
$page->assign('texte', $conf_text);
$page->assign('erreur', $erreur);
-
- return PL_OK;
}
+ function handler_admin(&$page, $action = 'list', $id = null) {
+ require_once('../classes/PLTableEditor.php');
+ $page->assign('xorg_title','Polytechnique.org - 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->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('mail','email contact',true);
+ $table_editor->describe('confirmation','message confirmation',false);
+ $table_editor->apply($page, $action, $id);
+ }
}
?>