Adapts notification for Xettes, and fixes notification emails (Closes #734)
authorVincent Zanotti <vincent.zanotti@polytechnique.org>
Sun, 23 Mar 2008 23:54:10 +0000 (00:54 +0100)
committerVincent Zanotti <vincent.zanotti@polytechnique.org>
Sun, 23 Mar 2008 23:54:47 +0000 (00:54 +0100)
Signed-off-by: Vincent Zanotti <vincent.zanotti@polytechnique.org>
include/notifs.inc.php
templates/carnet/notif.mail.tpl
templates/carnet/panel.tpl
upgrade/0.9.16/09_watch_cat.sql [new file with mode: 0644]

index 95ae89c..0bcf655 100644 (file)
@@ -82,7 +82,7 @@ function _select_notifs_base($table, $mail, $where)
     $sql = "
         (
             SELECT  u.promo, u.prenom, IF(u.nom_usage='',u.nom,u.nom_usage) AS nom,
-                    u.deces != 0 AS dcd,
+                    u.deces != 0 AS dcd, (u.flags = 'femme') AS sexe,
                     a.alias AS bestalias,
                     wo.*,
                     {$our['contact_sql']} AS contact,
@@ -90,7 +90,7 @@ function _select_notifs_base($table, $mail, $where)
     if ($mail) {
         $sql.=",
             w.uid AS aid, v.prenom AS aprenom, IF(v.nom_usage='',v.nom,v.nom_usage) AS anom,
-            b.alias AS abestalias, (v.flags='femme') AS sexe, q.core_mail_fmt AS mail_fmt";
+            b.alias AS abestalias, (v.flags='femme') AS asexe, q.core_mail_fmt AS mail_fmt";
     }
 
     $sql .= "
@@ -203,10 +203,10 @@ class AllNotifs
             $aid = $tmp['aid'];
             if (empty($this->_data[$aid])) {
                 $this->_data[$aid] = Array("prenom" => $tmp['aprenom'], 'nom' => $tmp['anom'],
-                    'bestalias'=>$tmp['abestalias'], 'sexe' => $tmp['sexe'], 'mail_fmt' => $tmp['mail_fmt'],
+                    'bestalias'=>$tmp['abestalias'], 'sexe' => $tmp['asexe'], 'mail_fmt' => $tmp['mail_fmt'],
                     'dcd'=>$tmp['dcd']);
             }
-            unset($tmp['aprenom'], $tmp['anom'], $tmp['abestalias'], $tmp['aid'], $tmp['sexe'], $tmp['mail_fmt'], $tmp['dcd']);
+            unset($tmp['aprenom'], $tmp['anom'], $tmp['abestalias'], $tmp['aid'], $tmp['asexe'], $tmp['mail_fmt'], $tmp['dcd']);
             $this->_data[$aid]['data'][$tmp['cid']][] = $tmp;
         }
     }
index 3f132e2..829e12e 100644 (file)
@@ -35,17 +35,17 @@ Tu trouveras les mêmes informations sur [[https://www.polytechnique.org/carnet/
 
 {foreach from=$u.data key=cid item=d}
 
-!{if $d|@count eq 1}{$cats[$cid].mail_sg}{else}{$cats[$cid].mail}{/if}&nbsp;:
+!{if $d|@count eq 1}{if $d[0].sexe}{$cats[$cid].mail_sg_xette}{else}{$cats[$cid].mail_sg}{/if}{else}{$cats[$cid].mail}{/if}:
 
-{foreach from=$d key=promo item=x}
-* (X{$x.promo}), le {$x.date|date_format:"%d %b %Y"}, [[https://www.polytechnique.org/profile/private/{$x.bestalias}|{$x.prenom} {$x.nom}]]
+{foreach from=$d item=x}
+* (X{$x.promo}), le {$x.date|date_format:"%d %B %Y"}, [[https://www.polytechnique.org/profile/private/{$x.bestalias}|{$x.prenom} {$x.nom}]]
 {/foreach}
 
 {/foreach}
--- 
+--
 L'Équipe de Polytechnique.org
 
-'''''Note&nbsp;:'''''  Tu reçois ce mail ce mail car tu as activé la notification automatique par mail des événements que tu surveilles.\\
+'''''Note:'''''  Tu reçois ce mail ce mail car tu as activé la notification automatique par mail des événements que tu surveilles.\\
 Tu peux changer cette options sur la [[https://www.polytechnique.org/carnet/notifs|page de configuration des notifications]].
 
 {/if}
index bde74a8..541a5da 100644 (file)
@@ -51,7 +51,11 @@ Il faut pour cela se rendre sur la page de <a href='carnet/notifs'>configuration
     {if ($promo|@count) > 1}
       {$notifs->_cats[$cid].mail}&nbsp;:
     {else}
-      {$notifs->_cats[$cid].mail_sg}&nbsp;:
+      {if $promo[0].sexe}
+        {$notifs->_cats[$cid].mail_sg_xette}&nbsp;:
+      {else}
+        {$notifs->_cats[$cid].mail_sg}&nbsp;:
+      {/if}
     {/if}
   {/foreach}
 {/if}</h2>
diff --git a/upgrade/0.9.16/09_watch_cat.sql b/upgrade/0.9.16/09_watch_cat.sql
new file mode 100644 (file)
index 0000000..7b11027
--- /dev/null
@@ -0,0 +1,7 @@
+ALTER TABLE watch_cat ADD COLUMN mail_sg_xette varchar(80) DEFAULT NULL AFTER mail_sg;
+UPDATE watch_cat SET mail_sg_xette = 'Cette camarade a mis sa fiche à jour' WHERE id = 1;
+UPDATE watch_cat SET mail_sg_xette = 'Cette camarade s\'est inscrite' WHERE id = 2;
+UPDATE watch_cat SET mail_sg_xette = 'Cette camarade nous a quittés' WHERE id = 3;
+UPDATE watch_cat SET mail_sg_xette = 'Cette camarade fête son anniversaire cette semaine' WHERE id = 4;
+
+# vim:set syntax=mysql: