Fixes page count in xnetevent administration.
authorStéphane Jacob <sj@m4x.org>
Sun, 29 May 2011 20:33:36 +0000 (22:33 +0200)
committerStéphane Jacob <sj@m4x.org>
Sun, 29 May 2011 20:36:10 +0000 (22:36 +0200)
Signed-off-by: Stéphane Jacob <sj@m4x.org>
modules/xnetevents.php
modules/xnetevents/xnetevents.inc.php

index d2d8390..edee012 100644 (file)
@@ -630,8 +630,7 @@ class XnetEventsModule extends PLModule
                                            GROUP BY  p.uid', $evt['eid']);
 
         $ofs = Env::i('offset');
-        $tot = (is_null($evt['nb_tot']) ? $evt['nb'] : $evt['nb_tot']);
-        $nbp = ceil($tot / NB_PER_PAGE);
+        $nbp = ceil($evt['user_count'] / NB_PER_PAGE);
         if ($nbp > 1) {
             $links = array();
             if ($ofs) {
index aec08cf..c60b938 100644 (file)
@@ -27,7 +27,7 @@ function get_event_detail($eid, $item_id = false, $asso_id = null)
     if (is_null($asso_id)) {
         $asso_id = $globals->asso('id');
     }
-    $evt = XDB::fetchOneAssoc('SELECT  SUM(nb) AS nb_tot, COUNT(DISTINCT ep.uid) AS nb, e.*,
+    $evt = XDB::fetchOneAssoc('SELECT  SUM(nb) AS nb_tot, COUNT(DISTINCT ep.uid) AS nb, e.*, SUM(IF(nb > 0, 1, 0)) AS user_count,
                                        IF(e.deadline_inscription,
                                           e.deadline_inscription >= LEFT(NOW(), 10),
                                           1) AS inscr_open,