Admin can cancel subscription to an event. Closes #737
authorPascal Corpet <pascal.corpet@m4x.org>
Mon, 7 Jun 2010 22:31:05 +0000 (00:31 +0200)
committerPascal Corpet <pascal.corpet@m4x.org>
Mon, 7 Jun 2010 22:31:05 +0000 (00:31 +0200)
ChangeLog
modules/xnetevents.php
templates/xnetevents/admin.tpl

index d83d3fd..64a5a31 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -39,6 +39,9 @@ Bug/Wish:
         - #993: Enables survey for oranges                                 -Car
         - #1002: Lets the user set promo interval in both ways             -Car
 
+    * XnetEvents:
+        - #737: Admin can cancel subscription to an event                  -Car
+
     * XnetLists:
         - #1010: Prevent empty list creation                               -Car
 
index f99e8e8..708bdd1 100644 (file)
@@ -577,7 +577,14 @@ class XnetEventsModule extends PLModule
                                  GROUP BY uid",
                                             $member->uid, $evt['eid']);
                 $u = $res->fetchOneAssoc();
-                $u = $u['cnt'] ? $u['nb'] : null;
+                if ($u['cnt'] == 1 && $paid == 0 && Post::v('cancel')) {
+                    XDB::execute("DELETE FROM group_event_participants
+                                        WHERE uid = {?} AND eid = {?}",
+                                    $member->uid, $evt['eid']);
+                    $u = 0;
+                } else {
+                    $u = $u['cnt'] ? $u['nb'] : null;
+                }
                 subscribe_lists_event($u, $member->uid, $evt, $paid);
             }
 
index 42aa631..d6f1690 100644 (file)
@@ -225,7 +225,7 @@ Ils ont payé mais ont oublié de s'inscrire&nbsp;:
 {if $is_admin}
 
 <p class="descr">
-  <a href="{$platal->ns}events/csv/{$evt.eid}/{$platal->argv[2]}/{$evt.intitule}{if $evt.titre}.{$evt.titre}{/if}.csv">
+  <a href="{$platal->ns}events/csv/{$evt.eid}/{$platal->argv[2]}/{$evt.intitule|escape:url}{if $evt.titre}.{$evt.titre|escape:url}{/if}.csv">
     {icon name=page_excel title="Télécharger au format Excel"} Télécharger le fichier Excel
   </a>
 </p>
@@ -255,6 +255,12 @@ Donne ici son email, ainsi que le nombre de participants.
     {/if}
     <input type="submit" />
   </p>
+  <p class="descr">
+    Tu peux aussi enlever toute trace de son inscription ou de sa décision de ne pas s'insscrire (s'il n'a rien payé).
+    <div class="center">
+      <input type="submit" name="cancel" value="Annuler l'inscription" />
+    </div>
+  </p>
 </form>
 
 {if $evt.money}