X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;f=include%2Fvalidations%2Fpaiements.inc.php;h=ee73771fce6e1c681cde345b5e828d8275b05f97;hb=493b6abebf3d6c35691f66fd1bfdc063efaab576;hp=e0aafcaf485df73c92ef3b45a3e9f34e9e6ac04c;hpb=50a40a33a496131e817df875607ea5542d096a64;p=platal.git diff --git a/include/validations/paiements.inc.php b/include/validations/paiements.inc.php index e0aafca..ee73771 100644 --- a/include/validations/paiements.inc.php +++ b/include/validations/paiements.inc.php @@ -1,6 +1,6 @@ Validate($_uid, false, 'paiements', $_stamp); - + $this->titre = $_intitule; $this->site = $_site; $this->msg_reponse = $_msg; @@ -57,18 +58,18 @@ class PayReq extends Validate $this->montant_max = $_montantmax; if ($_asso_id) { - $res = $globals->xdb->query("SELECT nom FROM groupex.asso WHERE id = {?}", $_asso_id); + $res = XDB::query("SELECT nom FROM groupex.asso WHERE id = {?}", $_asso_id); $this->asso = $res->fetchOneCell(); } if ($_asso_id && $_evt) { - $res = $globals->xdb->query("SELECT intitule FROM groupex.evenements WHERE asso_id = {?} AND eid = {?}", $_asso_id, $_evt); + $res = XDB::query("SELECT intitule FROM groupex.evenements WHERE asso_id = {?} AND eid = {?}", $_asso_id, $_evt); $this->evt_intitule = $res->fetchOneCell(); } } // }}} // {{{ function same_event() - function same_event($evt, $asso_id) + static function same_event($evt, $asso_id) { $wevt = 's:3:"evt";s:'.strlen($evt+"").':"'.$evt.'"'; $wassoid = 's:7:"asso_id";s:'.strlen($asso_id + "").':"'.$asso_id.'"'; @@ -80,10 +81,9 @@ class PayReq extends Validate // supprime les demandes de paiments pour le meme evenement function submit() { - global $globals; if ($this->evt) { - $globals->xdb->execute('DELETE FROM requests WHERE type={?} AND data LIKE {?}', 'paiements', PayReq::same_event($this->evt, $this->asso_id)); + XDB::execute('DELETE FROM requests WHERE type={?} AND data LIKE {?}', 'paiements', PayReq::same_event($this->evt, $this->asso_id)); } Validate::submit(); } @@ -94,11 +94,33 @@ class PayReq extends Validate { return 'include/form.valid.paiements.tpl'; } // }}} + // {{{ function editor() + + function editor() + { + return 'include/form.valid.edit-paiements.tpl'; + } + + // }}} + // {{{ function handle_editor() + + function handle_editor() + { + $this->titre = Env::v('pay_titre'); + $this->site = Env::v('pay_site'); + $this->montant = Env::i('pay_montant'); + $this->montant_min = Env::i('pay_montant_min'); + $this->montant_max = Env::i('pay_montant_max'); + $this->msg_reponse = Env::v('pay_msg_reponse'); + return true; + } + + // }}} // {{{ function _mail_subj function _mail_subj() { - return "[Polytechnique.org/Paiments] Demande de création de paiement {$this->titre}"; + return "[Polytechnique.org/Paiments] Demande de création de paiement {$this->titre}"; } // }}} @@ -107,9 +129,9 @@ class PayReq extends Validate function _mail_body($isok) { if ($isok) { - return " Le paiement que tu avais demandé pour {$this->titre} vient d'être créé.".($this->evt?" Il a bien été associé à la gestion de l'événement du groupe":""); + return " Le paiement que tu avais demandé pour {$this->titre} vient d'être créé.".($this->evt?" Il a bien été associé à la gestion de l'événement du groupe":""); } else { - return " La demande que tu avais faite pour le paiement de {$this->intitule} a été refusée."; + return " La demande que tu avais faite pour le paiement de {$this->intitule} a été refusée."; } } @@ -119,9 +141,9 @@ class PayReq extends Validate function commit() { global $globals; - $res = $globals->xdb->query("SELECT MAX(id) FROM paiement.paiements"); + $res = XDB::query("SELECT MAX(id) FROM paiement.paiements"); $id = $res->fetchOneCell()+1; - $ret = $globals->xdb->execute("INSERT INTO paiement.paiements VALUES + $ret = XDB::execute("INSERT INTO paiement.paiements VALUES ( {?}, {?}, {?}, '', {?}, {?}, {?}, {?}, {?}, {?} ) @@ -130,7 +152,7 @@ class PayReq extends Validate $this->montant, $this->montant_min, $this->montant_max, $this->bestalias."@".$globals->mail->domain, $this->msg_reponse, $this->asso_id); if ($this->asso_id && $this->evt) - $ret = $globals->xdb->execute("UPDATE groupex.evenements SET paiement_id = {?} WHERE asso_id = {?} AND eid = {?}", $id, $this->asso_id, $this->evt); + $ret = XDB::execute("UPDATE groupex.evenements SET paiement_id = {?} WHERE asso_id = {?} AND eid = {?}", $id, $this->asso_id, $this->evt); return $ret; } @@ -140,5 +162,5 @@ class PayReq extends Validate // }}} -// vim:set et sw=4 sts=4 sws=4 foldmethod=marker: +// vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8: ?>