X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;f=include%2Fvalidations%2Fpaiements.inc.php;h=0214520709bfc79f8772bbbbfd5284092ebea3e4;hb=7088a2a53904dc8bf3b84dcb374575bb36f22f8e;hp=250980620411e8f7b44b8aebcdd373c9fe7f3da9;hpb=e999a40a812f8a2f350d69c5e1611669ff8937d1;p=platal.git diff --git a/include/validations/paiements.inc.php b/include/validations/paiements.inc.php index 2509806..0214520 100644 --- a/include/validations/paiements.inc.php +++ b/include/validations/paiements.inc.php @@ -37,7 +37,7 @@ class PayReq extends Validate public $asso; public $evt; public $evt_intitule; - public $donation; + public $public; 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 []. @@ -47,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, $_donation = false, $_stamp=0) + $_evt = 0, $_public = false, $_stamp = 0) { parent::__construct($_user, false, 'paiements', $_stamp); @@ -56,10 +56,10 @@ 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; + $this->public = $_public; if ($_asso_id) { $res = XDB::query("SELECT nom FROM groups WHERE id = {?}", $_asso_id); @@ -89,7 +89,7 @@ Si le télépaiement n'est pas lié à un groupe ou supérieur à 51 euros, lais public function accept() { // no text [AI JMIAJM IJA MIJ] - if (preg_match('/\[[-\'"A-Z ]+\]/', $this->msg_reponse)) { + if (preg_match('/\[[-\'"a-zA-Z ]+\]/', replace_accent($this->msg_reponse))) { $this->trigError("La demande de paiement n'est pas valide. Merci de compléter le texte avant de la soumettre"); return false; } @@ -139,6 +139,7 @@ Si le télépaiement n'est pas lié à un groupe ou supérieur à 51 euros, lais $this->montant_min = Env::i('pay_montant_min'); $this->montant_max = Env::i('pay_montant_max'); $this->msg_reponse = Env::v('pay_msg_reponse'); + $this->public = (Env::v('pay_public') == 'yes'); return true; } @@ -169,11 +170,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; - $flags = ($this->donation ? 'donation' : ''); - $ret = XDB::execute('INSERT INTO payments (id, text, url, flags, amount_def, amount_min, amount_max, mail, confirmation, asso_id) + $ret = XDB::execute('INSERT INTO payments (id, text, url, amount_def, amount_min, amount_max, mail, confirmation, asso_id, flags) VALUES ({?}, {?}, {?}, {?}, {?}, {?}, {?}, {?}, {?}, {?})', - $id, $this->titre, $this->site, $flags, $this->montant, $this->montant_min, - $this->montant_max, $this->user->bestEmail(), $this->msg_reponse, $this->asso_id); + $id, $this->titre, $this->site, $this->montant, $this->montant_min, + $this->montant_max, $this->user->bestEmail(), $this->msg_reponse, $this->asso_id, + ($this->public ? 'public' : '')); if ($this->asso_id && $this->evt) { XDB::execute("UPDATE group_events SET paiement_id = {?}