Fixes alternative payements given by admins in events (Closes #1577)
authorBrice Gelineau <brice.gelineau@polytechnique.org>
Sat, 26 Nov 2011 20:54:40 +0000 (21:54 +0100)
committerBrice Gelineau <brice.gelineau@polytechnique.org>
Sat, 26 Nov 2011 21:00:04 +0000 (22:00 +0100)
Signed-off-by: Brice Gelineau <brice.gelineau@polytechnique.org>
ChangeLog
modules/xnetevents.php
modules/xnetevents/xnetevents.inc.php

index cd91140..886db4c 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -6,6 +6,9 @@ Bug/Wish:
     * Search:
         - #1574: Correctly displays State corps                            -GLN
 
+    * XnetEvent:
+        - #1577: Fixes alternative payements given by admins               -GLN
+
 From 1.1.4 branch:
 
     * XnetEvent:
index 0dc18e3..f4c04ec 100644 (file)
@@ -594,7 +594,9 @@ class XnetEventsModule extends PLModule
                 $amount = strtr(Env::v('montant'), ',', '.');
                 XDB::execute("UPDATE group_event_participants
                                  SET paid = paid + {?}
-                               WHERE uid = {?} AND eid = {?} AND item_id = 1",
+                               WHERE uid = {?} AND eid = {?} AND nb > 0
+                            ORDER BY item_id ASC
+                               LIMIT 1",
                              $amount, $member->uid, $evt['eid']);
                 subscribe_lists_event($member->uid, $evt['short_name'], 1, $amount);
             }
index dcc8d26..fe20a8e 100644 (file)
@@ -79,7 +79,7 @@ function get_event_detail($eid, $item_id = false, $asso_id = null)
         if ($m['montant']) {
             $evt['money'] = true;
         }
-        $evt['paid']  = $m['paid'];
+        $evt['paid'] += $m['paid'];
         $evt['notify_payment'] = $evt['notify_payment'] || $m['notify_payment'];
     }