Close #719: don't try to sum comers on multiple parts of an event
authorFlorent Bruneau <florent.bruneau@polytechnique.org>
Fri, 14 Sep 2007 20:27:20 +0000 (22:27 +0200)
committerFlorent Bruneau <florent.bruneau@polytechnique.org>
Fri, 14 Sep 2007 20:27:20 +0000 (22:27 +0200)
Signed-off-by: Florent Bruneau <florent.bruneau@polytechnique.org>
ChangeLog
modules/xnetevents/xnetevents.inc.php
templates/xnetevents/admin.tpl

index 831bfaf..5ac484e 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -53,6 +53,7 @@ Bug/Wish:
 
     * XnetEvents:
         - #695: More details about payments                                -FRU
+        - #719: More consistent subscription count                         -FRU
 
 From 0.9.14 branch:
 
index 73af616..d0f80a1 100644 (file)
@@ -25,7 +25,7 @@ function get_event_detail($eid, $item_id = false)
 {
     global $globals;
     $res = XDB::query(
-        "SELECT        SUM(nb) AS nb_tot, e.*,
+        "SELECT        SUM(nb) AS nb_tot, COUNT(DISTINCT ep.uid) AS nb, e.*,
                 IF(e.deadline_inscription, e.deadline_inscription >= LEFT(NOW(), 10),
                    1) AS inscr_open,
                 LEFT(10, e.debut) AS debut_day, LEFT(10, e.fin) AS fin_day,
index 72d6ec1..658852b 100644 (file)
 <h1>{$asso.nom} : <a href='{$platal->ns}events'>Evénements</a> </h1>
 
 <p>
-L'événement {$evt.intitule} {if $evt.titre} - {$evt.titre}{/if} comptera
-{$evt.nb_tot} personne{if $evt.nb_tot > 1}s{/if}.
+L'événement {$evt.intitule}
+{if $evt.titre} - {$evt.titre}
+{/if}
+{if $evt.titre || count($moments) eq 0}
+comptera {$evt.nb_tot} personne{if $evt.nb_tot > 1}s{/if}.
+{else}
+({$evt.nb} personne{if $evt.nb > 1}s{/if} ont réalisé leur inscription).
+{/if}
 </p>
 
 {if $evt.participant_list}
@@ -100,7 +106,7 @@ Ils ont payé mais ont oublié de s'inscrire :
 
 <table summary="participants a l'evenement" class="{if $tout}large{else}tiny{/if}">
   <tr>
-    {if $is_admin && $evt.paiement_id}
+    {if $is_admin && $evt.paiement_id && $tout}
       {assign var=height value='rowspan="2"'}
     {/if}
     <th {$height|smarty:nodefaults}>Prénom NOM</th>
@@ -122,7 +128,7 @@ Ils ont payé mais ont oublié de s'inscrire :
     <th {$height|smarty:nodefaults}>Nombre</th>
     {/if}
   </tr>
-  {if $is_admin && $evt.paiement_id}
+  {if $is_admin && $evt.paiement_id && $tout}
   <tr>
     <th>Télépaiement</th>
     <th>Autre</th>