From f85d57393a8f1233589c884af9986f5ee38901e9 Mon Sep 17 00:00:00 2001 From: =?utf8?q?St=C3=A9phane=20Jacob?= Date: Mon, 16 May 2011 23:49:28 +0200 Subject: [PATCH] Adds notion of donation for payments. MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Stéphane Jacob --- include/validations/paiements.inc.php | 17 ++++++++--------- modules/xnetevents.php | 2 +- templates/xnetevents/edit.tpl | 1 + upgrade/1.1.2/02_payments.sql | 3 +++ 4 files changed, 13 insertions(+), 10 deletions(-) create mode 100644 upgrade/1.1.2/02_payments.sql diff --git a/include/validations/paiements.inc.php b/include/validations/paiements.inc.php index afbead3..2509806 100644 --- a/include/validations/paiements.inc.php +++ b/include/validations/paiements.inc.php @@ -37,6 +37,7 @@ class PayReq extends Validate public $asso; public $evt; public $evt_intitule; + public $donation; public $rules = "Vérifier que les balises <salutation>, <prenom>, <nom>, <montant> et <comment> n'ont pas été modifiées. Vérifier que le demandeur n'a pas laissé les crochets []. @@ -46,7 +47,7 @@ Si le télépaiement n'est pas lié à un groupe ou supérieur à 51 euros, lais public function __construct(User $_user, $_intitule, $_site, $_montant, $_msg, $_montantmin=0, $_montantmax=999, $_asso_id = 0, - $_evt = 0, $_stamp=0) + $_evt = 0, $_donation = false, $_stamp=0) { parent::__construct($_user, false, 'paiements', $_stamp); @@ -55,6 +56,7 @@ Si le télépaiement n'est pas lié à un groupe ou supérieur à 51 euros, lais $this->msg_reponse = $_msg; $this->asso_id = (string)$_asso_id; $this->evt = (string)$_evt; + $this->donation = $_donation; $this->montant = $_montant; $this->montant_min = $_montantmin; $this->montant_max = $_montantmax; @@ -167,14 +169,11 @@ Si le télépaiement n'est pas lié à un groupe ou supérieur à 51 euros, lais { $res = XDB::query("SELECT MAX(id) FROM payments"); $id = $res->fetchOneCell()+1; - $ret = XDB::execute("INSERT INTO payments VALUES - ( {?}, {?}, {?}, '', - {?}, {?}, {?}, - {?}, {?}, {?} ) - ", - $id, $this->titre, $this->site, - $this->montant, $this->montant_min, $this->montant_max, - $this->user->bestEmail(), $this->msg_reponse, $this->asso_id); + $flags = ($this->donation ? 'donation' : ''); + $ret = XDB::execute('INSERT INTO payments (id, text, url, flags, amount_def, amount_min, amount_max, mail, confirmation, asso_id) + VALUES ({?}, {?}, {?}, {?}, {?}, {?}, {?}, {?}, {?}, {?})', + $id, $this->titre, $this->site, $flags, $this->montant, $this->montant_min, + $this->montant_max, $this->user->bestEmail(), $this->msg_reponse, $this->asso_id); if ($this->asso_id && $this->evt) { XDB::execute("UPDATE group_events SET paiement_id = {?} diff --git a/modules/xnetevents.php b/modules/xnetevents.php index bf975e1..45767f5 100644 --- a/modules/xnetevents.php +++ b/modules/xnetevents.php @@ -468,7 +468,7 @@ class XnetEventsModule extends PLModule Post::v('intitule')." - ".$globals->asso('nom'), Post::v('site'), $money_defaut, Post::v('confirmation'), 0, 999, - $globals->asso('id'), $eid); + $globals->asso('id'), $eid, Post::b('donation')); if ($p->accept()) { $p->submit(); } else { diff --git a/templates/xnetevents/edit.tpl b/templates/xnetevents/edit.tpl index 99292bc..09053af 100644 --- a/templates/xnetevents/edit.tpl +++ b/templates/xnetevents/edit.tpl @@ -201,6 +201,7 @@ Ton inscription à [METS LE NOM DE L'ÉVÉNEMENT ICI] a bien été enregistrée {$profile->fullName("promo")}{/if}
{assign var='asso_url' value=$globals->baseurl|cat:'/'|cat:$platal->ns} Page internet de l'événement :
+
Le nouveau paiement sera activé automatiquement après validation par le trésorier de Polytechnique.org, ce qui sera fait sous peu.