To avoid support requests, show an explicite message when the event exists but you...
authorFlorent Bruneau <florent.bruneau@polytechnique.org>
Mon, 1 Sep 2008 19:22:00 +0000 (21:22 +0200)
committerFlorent Bruneau <florent.bruneau@polytechnique.org>
Mon, 1 Sep 2008 19:22:00 +0000 (21:22 +0200)
Signed-off-by: Florent Bruneau <florent.bruneau@polytechnique.org>
modules/xnetevents.php
modules/xnetevents/xnetevents.inc.php

index 77abf91..d7f5301 100644 (file)
@@ -183,9 +183,18 @@ class XnetEventsModule extends PLModule
         $page->changeTpl('xnetevents/subscribe.tpl');
 
         $evt = get_event_detail($eid);
-        if (!$evt) {
+        if (is_null($evt)) {
             return PL_NOT_FOUND;
         }
+        if ($evt === false) {
+            global $globals, $platal;
+            $url = $globals->asso('sub_url');
+            if (empty($url)) {
+                $url = $platal->ns . 'subscribe';
+            }
+            $page->kill('Cet événement est reservé aux membres du groupe ' . $globals->asso('nom') .
+                        '. Pour devenir membre, rends-toi sur la page de <a href="' . $url . '">demande d\'inscripton</a>.');
+        }
 
         if (!$evt['inscr_open']) {
             $page->kill('Les inscriptions pour cet événement sont closes');
index 1303d9c..b0fab12 100644 (file)
@@ -51,9 +51,12 @@ function get_event_detail($eid, $item_id = false, $asso_id = null)
 
     $evt = $res->fetchOneAssoc();
 
-    if (!$evt || ($GLOBALS['IS_XNET_SITE'] && $evt['accept_nonmembre'] == 0 && !is_member() && !may_update())) {
+    if (!$evt) {
         return null;
     }
+    if ($GLOBALS['IS_XNET_SITE'] && $evt['accept_nonmembre'] == 0 && !is_member() && !may_update()) {
+        return false;
+    }
 
     // smart calculation of the total number
     if (!$item_id) {