From: Florent Bruneau Date: Wed, 3 Oct 2007 18:50:54 +0000 (+0200) Subject: Fix paiement association to event in prompt just before being redirected to X-Git-Tag: xorg/0.9.15~74 X-Git-Url: http://git.polytechnique.org/?a=commitdiff_plain;h=614199d8cd3b1c99c61de5455beb29ec27495147;p=platal.git Fix paiement association to event in prompt just before being redirected to the bank site. Signed-off-by: Florent Bruneau --- diff --git a/modules/payment/money.inc.php b/modules/payment/money.inc.php index a79f03a..4a46fc7 100644 --- a/modules/payment/money.inc.php +++ b/modules/payment/money.inc.php @@ -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; }