X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;f=modules%2Fpayment%2Fmoney.inc.php;h=a5aae56299fd746ab5cd71ef6d600d7b2cfa23a3;hb=9f97216c33993e507e50ed31e070ce1a1d32cbcf;hp=ab32ff94f4e66a12117287c7fab06efbfe9ae39a;hpb=a7de4ef724d1a3b0bf978a50ce7cc9d23412c7a0;p=platal.git diff --git a/modules/payment/money.inc.php b/modules/payment/money.inc.php index ab32ff9..a5aae56 100644 --- a/modules/payment/money.inc.php +++ b/modules/payment/money.inc.php @@ -1,6 +1,6 @@ money->mpay_def_id : $ref; $res = XDB::query("SELECT id, text, url, flags, mail, montant_min, montant_max, montant_def, asso_id - FROM {$globals->money->mpay_tprefix}paiements WHERE id={?}", $r); + FROM {$globals->money->mpay_tprefix}paiements WHERE id={?}", $r); list($this->id, $this->text, $this->url, $flags, $this->mail, - $this->montant_min, $this->montant_max, $this->montant_def, $this->asso_id) = $res->fetchOneRow(); - + $this->montant_min, $this->montant_max, $this->montant_def, $this->asso_id) = $res->fetchOneRow(); + $this->montant_min = (float)$this->montant_min; $this->montant_max = (float)$this->montant_max; - $this->flags = new Flagset($flags); + $this->flags = new PlFlagSet($flags); } // }}} // {{{ function check() - + function check($value) { $v = (float)strtr($value, ',', '.'); @@ -87,8 +87,14 @@ class Payment function event() { if ($this->asso_id) { - $res = XDB::query("SELECT eid, a.diminutif FROM groupex.evenements AS e, groupex.asso AS a WHERE e.asso_id = {?} AND a.id = {?}", $this->asso_id, $this->asso_id); - return $res->fetchOneAssoc(); + $res = XDB::query("SELECT e.eid, a.diminutif + FROM groupex.evenements AS e + INNER JOIN groupex.asso AS a ON (e.asso_id = a.id) + LEFT JOIN groupex.evenements_participants AS p ON (p.eid = e.eid AND p.uid = {?}) + WHERE e.paiement_id = {?} AND p.uid IS NULL", S::i('uid'), $this->id); + if ($res->numRows()) { + return $res->fetchOneAssoc(); + } } return null; } @@ -114,7 +120,7 @@ class PayMethod $i = $id==-1 ? $globals->money->mpay_def_meth : $id; $res = XDB::query("SELECT id,text,include FROM {$globals->money->mpay_tprefix}methodes WHERE id={?}", $i); list($this->id, $this->text, $this->inc) = $res->fetchOneRow(); - } + } // }}} }