Backport bugfix inscription evenement
authorx2002bobillot <x2002bobillot@839d8a87-29fc-0310-9880-83ba4fa771e5>
Sat, 4 Feb 2006 16:49:25 +0000 (16:49 +0000)
committerx2002bobillot <x2002bobillot@839d8a87-29fc-0310-9880-83ba4fa771e5>
Sat, 4 Feb 2006 16:49:25 +0000 (16:49 +0000)
git-svn-id: svn+ssh://murphy/home/svn/platal/trunk@226 839d8a87-29fc-0310-9880-83ba4fa771e5

htdocs.net/groupe/evenements.php
templates/xnet/groupe/evenements.tpl

index d35f1ed..5d76eff 100644 (file)
@@ -52,18 +52,18 @@ if (Env::has('ins')) {
         // impossible to unsubscribe if you already paid sthing
         $total_inscr = 0;
         $inscriptions = array();
-        for ($i=1; Env::has('moment'.$eid.'_'.$i); $i++)
+        for ($j=1; Env::has('moment'.$eid.'_'.$j); $j++)
         {
-            $inscriptions[$i] = Env::get('moment'.$eid.'_'.$i);
+            $inscriptions[$j] = Env::get('moment'.$eid.'_'.$j);
             // retreive ohter field when more than one person
-            if ($inscriptions[$i] == 2)
-                $inscriptions[$i] = 1 + Env::get('personnes'.$eid.'_'.$i,0);
+            if ($inscriptions[$j] == 2)
+                $inscriptions[$j] = 1 + Env::get('personnes'.$eid.'_'.$j,0);
             // avoid negative count if other field incorrect
-            if ($inscriptions[$i] < 0)
-                $inscriptions[$i] = 0;
+            if ($inscriptions[$j] < 0)
+                $inscriptions[$j] = 0;
             // avoid floating count if other field incorrect
-            $inscriptions[$i] = floor($inscriptions[$i]);
-            $total_inscr += $inscriptions[$i];
+            $inscriptions[$j] = floor($inscriptions[$j]);
+            $total_inscr += $inscriptions[$j];
         }
         $unsubscribing = ($total_inscr == 0);
 
@@ -84,21 +84,21 @@ if (Env::has('ins')) {
         }
 
         // update actual inscriptions
-        foreach ($inscriptions as $i=>$nb)
+        foreach ($inscriptions as $j=>$nb)
         {
             if ($nb > 0)
             {
                $globals->xdb->execute(
                    "REPLACE INTO  groupex.evenements_participants
                           VALUES  ({?}, {?}, {?}, {?}, {?})",
-                   $eid, Session::get("uid"), $i, $nb, $paid);
+                   $eid, Session::get("uid"), $j, $nb, $paid);
             }
             else
             {
                $globals->xdb->execute(
                    "DELETE FROM  groupex.evenements_participants
                           WHERE  eid = {?} AND uid = {?} AND item_id = {?}",
-                   $eid, Session::get("uid"), $i);             
+                   $eid, Session::get("uid"), $j);             
             }
         }
     }
index fbd0fbf..c5f07df 100644 (file)
@@ -149,6 +149,8 @@ Ev
     <p style="text-align:center">
       <input type="submit" value="Valider mes inscriptions" />
     </p>
+  {else}
+    <p>&nbsp;</p>
   {/if}
   {/foreach}