From: Anne Limoges Date: Tue, 15 Jan 2013 09:27:17 +0000 (+0100) Subject: Adds bankaccount edition in payment validation. X-Git-Tag: xorg/1.1.7~14 X-Git-Url: http://git.polytechnique.org/?a=commitdiff_plain;h=b9c627802fa9dd4e93666b8d95d325a259db3ec6;p=platal.git Adds bankaccount edition in payment validation. --- diff --git a/classes/phone.php b/classes/phone.php index 870f551..21be6a6 100644 --- a/classes/phone.php +++ b/classes/phone.php @@ -329,15 +329,17 @@ class Phone static private function formArrayWalk(array $data, $function, &$success = true, $requiresEmptyPhone = false, $maxPublicity = null) { $phones = array(); - foreach ($data as $item) { - $phone = new Phone($item); - $success = (!$phone->error && ($phone->format() || $phone->isEmpty()) && $success); - if (!$phone->isEmpty()) { - // Restrict phone visibility to $maxPublicity - if (!is_null($maxPublicity) && Visibility::isLessRestrictive($maxPublicity, $phone->pub)) { - $phone->pub = $maxPublicity; + if (!is_null($data)) { + foreach ($data as $item) { + $phone = new Phone($item); + $success = (!$phone->error && ($phone->format() || $phone->isEmpty()) && $success); + if (!$phone->isEmpty()) { + // Restrict phone visibility to $maxPublicity + if (!is_null($maxPublicity) && Visibility::isLessRestrictive($maxPublicity, $phone->pub)) { + $phone->pub = $maxPublicity; + } + $phones[] = call_user_func(array($phone, $function)); } - $phones[] = call_user_func(array($phone, $function)); } } if (count($phones) == 0 && $requiresEmptyPhone) { diff --git a/include/validations/paiements.inc.php b/include/validations/paiements.inc.php index 88e9c23..9bd54f6 100644 --- a/include/validations/paiements.inc.php +++ b/include/validations/paiements.inc.php @@ -38,6 +38,8 @@ class PayReq extends Validate public $evt; public $evt_intitule; public $public; + public $rib_id; + public $rib_nom; 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 []. @@ -69,6 +71,11 @@ Si le télépaiement n'est pas lié à un groupe ou supérieur à 51 euros, lais $res = XDB::query("SELECT intitule FROM group_events WHERE asso_id = {?} AND eid = {?}", $_asso_id, $_evt); $this->evt_intitule = $res->fetchOneCell(); } + // for future use, when anims can choose there bankaccounts + if ($this->rib_id) { + $res = XDB::query("SELECT owner FROM payment_bankaccounts WHERE id = {?}", $this->rib_id); + $this->rib_nom = $res->fetchOneCell(); + } } // }}} @@ -140,6 +147,13 @@ Si le télépaiement n'est pas lié à un groupe ou supérieur à 51 euros, lais $this->montant_max = Env::i('pay_montant_max'); $this->msg_reponse = Env::v('pay_msg_reponse'); $this->public = (Env::v('pay_public') == 'yes'); + $this->rib_id = Env::v('pay_rib_id'); + if ($this->rib_id) { + $res = XDB::query("SELECT owner FROM payment_bankaccounts WHERE id = {?}", $this->rib_id); + $this->rib_nom = $res->fetchOneCell(); + } else { + $this->rib_nom = null; + } return true; } @@ -170,11 +184,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 (id, text, url, amount_def, amount_min, amount_max, mail, confirmation, asso_id, flags) - VALUES ({?}, {?}, {?}, {?}, {?}, {?}, {?}, {?}, {?}, {?})', + $ret = XDB::execute('INSERT INTO payments (id, text, url, amount_def, amount_min, amount_max, mail, confirmation, asso_id, flags, rib_id) + VALUES ({?}, {?}, {?}, {?}, {?}, {?}, {?}, {?}, {?}, {?}, {?})', $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' : '')); + ($this->public ? 'public' : ''), $this->rib_id); if ($this->asso_id && $this->evt) { XDB::execute("UPDATE group_events SET paiement_id = {?} diff --git a/templates/include/form.valid.edit-paiements.tpl b/templates/include/form.valid.edit-paiements.tpl index 26e53a1..cdb94c5 100644 --- a/templates/include/form.valid.edit-paiements.tpl +++ b/templates/include/form.valid.edit-paiements.tpl @@ -36,5 +36,5 @@  - 
- +Rib_id :
{* vim:set et sw=2 sts=2 sws=2 enc=utf-8: *} diff --git a/templates/include/form.valid.paiements.tpl b/templates/include/form.valid.paiements.tpl index e714fe7..10de1d5 100644 --- a/templates/include/form.valid.paiements.tpl +++ b/templates/include/form.valid.paiements.tpl @@ -63,5 +63,9 @@ Public : {if $valid->public}Oui{else}Non{/if} + + RIB : + {if $valid->rib_id}{$valid->rib_nom}{else}NULL{/if} + {* vim:set et sw=2 sts=2 sws=2 enc=utf-8: *}