From: x2002bobillot Date: Sat, 4 Feb 2006 16:49:25 +0000 (+0000) Subject: Backport bugfix inscription evenement X-Git-Tag: xorg/0.9.10~123 X-Git-Url: http://git.polytechnique.org/?a=commitdiff_plain;h=82ab5344d3d08cf2911033b7d12204304a86725c;p=platal.git Backport bugfix inscription evenement git-svn-id: svn+ssh://murphy/home/svn/platal/trunk@226 839d8a87-29fc-0310-9880-83ba4fa771e5 --- diff --git a/htdocs.net/groupe/evenements.php b/htdocs.net/groupe/evenements.php index d35f1ed..5d76eff 100644 --- a/htdocs.net/groupe/evenements.php +++ b/htdocs.net/groupe/evenements.php @@ -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); } } } diff --git a/templates/xnet/groupe/evenements.tpl b/templates/xnet/groupe/evenements.tpl index fbd0fbf..c5f07df 100644 --- a/templates/xnet/groupe/evenements.tpl +++ b/templates/xnet/groupe/evenements.tpl @@ -149,6 +149,8 @@ Ev

+ {else} +

 

{/if} {/foreach}