bugs et apparence des evenements pour xnet
authorPascal Corpet <pascal.corpet@m4x.org>
Sun, 19 Jun 2005 15:43:48 +0000 (15:43 +0000)
committerFlorent Bruneau <florent.bruneau@polytechnique.org>
Thu, 26 Jun 2008 21:29:20 +0000 (23:29 +0200)
git-archimport-id: opensource@polytechnique.org--2005/platal--mainline--0.9--patch-728

htdocs.net/groupe/evt-admin.php
htdocs.net/groupe/evt-detail.php
templates/xnet/groupe/evt-admin.tpl
templates/xnet/groupe/evt-detail.tpl

index ecab320..7fc5a6c 100644 (file)
@@ -123,6 +123,21 @@ $ini = Env::has('initiale') ? 'AND IF(u.nom IS NULL,m.nom,IF(u.nom_usage<>"", u.
 
 $participants = get_event_participants(Env::get('eid'), Env::get('item_id'), $ini, $tri, "LIMIT ".($ofs*NB_PER_PAGE).", ".NB_PER_PAGE, $evt['money'] && $admin, $evt['paiement_id']);
 
+if ($evt['paiement_id']) {
+       $res = $globals->xdb->iterator(
+        "SELECT IF(u.nom_usage<>'', u.nom_usage, u.nom) AS nom, u.prenom,
+               u.promo, a.alias AS email, t.montant
+          FROM {$globals->money->mpay_tprefix}transactions AS t
+        INNER JOIN auth_user_md5 AS u ON(t.uid = u.user_id)
+         INNER JOIN aliases AS a ON (a.id = t.uid AND a.type='a_vie' )
+         LEFT JOIN groupex.evenements_participants AS ep ON(ep.uid = t.uid AND ep.eid = {?})
+         WHERE t.ref = {?} AND ep.uid IS NULL",
+         $evt['eid'], $evt['paiement_id']);
+       $page->assign('oublis', $res->total());
+       $page->assign('oubliinscription', $res);
+}
+
+       
 $page->assign('participants', $participants);
 
 $page->run();
index 25ddf73..3907385 100644 (file)
@@ -10,40 +10,48 @@ if (!Env::get("eid"))
 $may_participate = !$members_only || is_member() || may_update(); 
 $page->assign('may_participate', $may_participate);
 
-$participate = false;
-for ($i=1; Env::has('item_id'.$i); $i++)
-{
-    $res  = $globals->xdb->query("SELECT paid FROM groupex.evenements_participants WHERE eid = {?} AND uid = {?}", Env::get("eid"), Session::get("uid"));
-    $paid = $res->fetchOneCell();
-    $j    = Env::get('item_id'.$i);
-    $nb   = Env::get('item_'.$j);
-    if (!$paid) $paid = 0;
-    if ($nb == '+') $nb = Env::get('itemnb_'.$j)+1;
-    if ($nb > 0) {
-        $globals->xdb->execute(
-            "REPLACE INTO  groupex.evenements_participants
-                   VALUES  ({?}, {?}, {?}, {?}, {?})",
-            Env::get("eid"), Session::get("uid"), $j, $nb, $paid);
-        $participate = true;
-    } else {
-        $globals->xdb->execute(
-            "DELETE FROM  groupex.evenements_participants
-                   WHERE  eid = {?} AND uid = {?} AND item_id = {?}",
-            Env::get("eid"), Session::get("uid"), $j);         
-    }
+if (Env::get('ins')) {
+       $total = 0;
+       for ($i=1; Env::has('item_id'.$i); $i++)
+       $total += (Env::get('item_'.Env::get('item_id'.$i)) > 0)?Env::get('item_'.Env::get('item_id'.$i)):0;
+
+       $participate = $total > 0;
+       $res  = $globals->xdb->query("SELECT paid FROM groupex.evenements_participants WHERE eid = {?} AND uid = {?}", Env::get("eid"), Session::get("uid"));
+       $paid = $res->fetchOneCell();
+       if (!$paid) $paid = 0;
+
+       // prevent desinscription if there is a manual paiement
+       if (!$participate && $paid) {
+           $page->trig("Impossible de te désinscrire complètement parce que tu as fait un paiement par chèque ou par liquide. Contacte un administrateur du groupe si tu es sûr de ne pas venir");
+           $participate = true;
+           $page->assign('no_ins', true);
+       } else 
+       for ($i=1; Env::has('item_id'.$i); $i++)
+       {
+           $j    = Env::get('item_id'.$i);
+           $nb   = Env::get('item_'.$j);
+           if ($nb == '+') $nb = Env::get('itemnb_'.$j)+1;
+           if ($nb > 0) {
+               $globals->xdb->execute(
+                   "REPLACE INTO  groupex.evenements_participants
+                          VALUES  ({?}, {?}, {?}, {?}, {?})",
+                   Env::get("eid"), Session::get("uid"), $j, $nb, $paid);
+           } else {
+               $globals->xdb->execute(
+                   "DELETE FROM  groupex.evenements_participants
+                          WHERE  eid = {?} AND uid = {?} AND item_id = {?}",
+                   Env::get("eid"), Session::get("uid"), $j);          
+           }
+       }
 }
 
 require_once('xnet/evenements.php');
 $evt = get_event_detail(Env::get('eid'));
 if (Env::has('ins')) {
     subscribe_lists_event($participate, Session::get("uid"), $evt['participant_list'], $evt['absent_list']);
-    if ($participate) {
-        $page->trig("tu es maintenant inscrit à l'évenement, suis le lien en bas si tu souhaites procéder à un paiment par le web");
-    } else {
-        $page->trig("tu es maintenant désinscrit de cet évenement");
-    }
 }
 
+$page->assign('participate', $participate);
 $page->assign('evt', $evt);
 
 $moments = $globals->xdb->iterator(
@@ -59,6 +67,7 @@ $page->assign('moments', $moments);
 if (!$paid) {
     $res = $globals->xdb->query("SELECT paid FROM groupex.evenements_participants WHERE eid = {?} AND uid = {?}", Env::get("eid"), Session::get("uid"));
     $paid = $res->fetchOneCell();
+    $page->assign('paid_manual', $paid);
 }
 if ($evt['paiement_id']) {
     $res = $globals->xdb->query(
index d889589..cdfa7c0 100644 (file)
 
 <h1>{$asso.nom} : <a href='evenements.php'>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}.
+</p>
+
 {if $evt.participant_list}
 <p class="center">
 [<a href="mailto:{$evt.short_name}-participants@polytechnique.org">envoyer un mail à ceux qui viennent</a>] - [<a href="mailto:{$evt.short_name}-absents@polytechnique.org">envoyer un mail aux membres non inscrits</a>]
 </p>
 {/if}
 
-<p class="descr">
-L'événement {$evt.intitule} {if $evt.titre} - {$evt.titre}{/if} comptera {$evt.nb_tot} personne{if $evt.nb_tot > 1}s{/if}.
-</p>
-
 <p class="center">
 [<a href="{$url_page}" {if !$smarty.request.initiale}class="erreur"{/if}>tout</a>]
 {foreach from=$alphabet item=c}
@@ -48,6 +48,51 @@ L'
 {/foreach}
 </p>
 
+{if $admin}{literal}
+<script type="text/javascript">
+function remplitAuto(mail) {
+  document.getElementById('inscription').mail.value=mail;
+  document.getElementById('montant').mail.value=mail;
+  return false;
+}
+</script>
+{/literal}
+
+{if $oublis}
+<p class="erreur">
+Ils ont payé mais ont oublié de s'inscrire :
+</p>
+
+<table summary="payé mais non inscrits" class="tiny">
+  <tr>
+    <th>Prénom NOM</th>
+    <th>Promo</th>
+    <th>Infos</th>
+    <th>Montant</th>
+  </tr>
+  {iterate from=$oubliinscription item=m}
+  <tr style="background:#d0c198;">
+    <td>
+      <a href="" {if $admin}onclick="return remplitAuto('{$m.email}')"{/if}>
+      {$m.prenom} {$m.nom}
+      </a>
+    </td>
+    <td>{$m.promo}</td>
+    <td>
+      <a href="https://www.polytechnique.org/fiche.php?user={$m.email}"><img src="{rel}/images/loupe.gif" alt="[fiche]" /></a>
+      <a href="https://www.polytechnique.org/vcard.php/{$m.email}.vcf/?x={$m.email}"><img src="{rel}/images/vcard.png" alt="[vcard]" /></a>
+      <a href="mailto:{$m.email}@polytechnique.org"><img src="{rel}/images/mail.png" alt="mail" /></a>
+    </td>
+    <td>{$m.montant}</td>
+  </tr>
+  {/iterate}
+</table>
+
+<hr />
+{/if}
+
+{/if}
+
 <table summary="participants a l'evenement" class="{if $tout}large{else}tiny{/if}">
   <tr>
     <th>Prénom NOM</th>
@@ -68,7 +113,7 @@ L'
   {foreach from=$participants item=m}
   <tr style="background:#d0c198;">
     <td>
-      <a href="" onclick="document.getElementById('montant').mail.value='{$m.email}'; return false">
+      <a href="" {if $admin}onclick="return remplitAuto('{$m.email}')"{/if}>
         {if $m.femme}&bull;{/if}{$m.prenom} {$m.nom}
       </a>
     </td>
@@ -106,6 +151,7 @@ L'
 </p>
 
 {if $admin}
+
 <p class="descr">
 [<a href="evt-csv.php/{$evt.intitule}{if $evt.titre}.{$evt.titre}{/if}.csv?eid={$smarty.request.eid}&amp;item_id={$smarty.request.item_id}">Télécharger le fichier Excel</a>]
 </p>
@@ -118,7 +164,7 @@ Donne ici son mail (complet pour les ext
 nombre de participants.
 </p>
 
-<form action="{$smarty.server.REQUEST_URI}" method="post">
+<form action="{$smarty.server.REQUEST_URI}" method="post" id="inscription">
   <p class="descr">
   <input type="hidden" name="eid" value="{$smarty.request.eid}" />
   <input type="hidden" name="adm" value="nbs" />
index 3408aa6..69309a2 100644 (file)
 {*                                                                        *}
 {**************************************************************************}
 
+{if $smarty.request.ins && !$no_ins}
+  {if $participate}
+    Tu es maintenant inscrit à l'évenement.
+    {if $evt.paiement_id} Suis le lien en bas si tu souhaites procéder à un paiement par le web.{/if}
+  {else}
+    Tu es maintenant désinscrit de cet évenement.
+  {/if}
+{/if}
+
 <h1>{$asso.nom} : <a href="{$smarty.server.PHP_SELF}">Evénements</a></h1>
 
 <h2>{$evt.intitule}</h2>
@@ -71,9 +80,9 @@
   </table>
   
   {if $montant > 0 || $paid > 0}
-  <p class="erreur">
+  <p {if $montant > $paid}class="erreur"{/if}>
   Pour cet événement tu dois payer {$montant|replace:'.':','}&nbsp;&euro; {if $paid > 0}, et tu as déjà payé {$paid|replace:'.':','}&nbsp;&euro;{/if}
-  {if $evt.paiement_id}[<a href="https://www.polytechnique.org/paiement/?ref={$evt.paiement_id}">Effectuer le paiement</a>]{/if}
+  {if $evt.paiement_id} [<a href="https://www.polytechnique.org/paiement/?ref={$evt.paiement_id}">Effectuer le paiement</a>]{/if}
   </p>
   {/if}
   <div class="center">