X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;f=include%2Fvalidations%2Fpaiements.inc.php;h=250980620411e8f7b44b8aebcdd373c9fe7f3da9;hb=15b9758d68d315d2600af1741b36b44efe3b2cef;hp=afbead36104985f1d093d9a35b6b437e58019fbd;hpb=87c297112074d1da4773359b7c9d17d5fab0ff1b;p=platal.git 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 = {?}