From 1430b1f1ba64b380e5fac3a3c7989538fe56913a Mon Sep 17 00:00:00 2001 From: Vincent Zanotti Date: Mon, 24 Mar 2008 00:54:10 +0100 Subject: [PATCH] Adapts notification for Xettes, and fixes notification emails (Closes #734) Signed-off-by: Vincent Zanotti --- include/notifs.inc.php | 8 ++++---- templates/carnet/notif.mail.tpl | 10 +++++----- templates/carnet/panel.tpl | 6 +++++- upgrade/0.9.16/09_watch_cat.sql | 7 +++++++ 4 files changed, 21 insertions(+), 10 deletions(-) create mode 100644 upgrade/0.9.16/09_watch_cat.sql diff --git a/include/notifs.inc.php b/include/notifs.inc.php index 95ae89c..0bcf655 100644 --- a/include/notifs.inc.php +++ b/include/notifs.inc.php @@ -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; } } diff --git a/templates/carnet/notif.mail.tpl b/templates/carnet/notif.mail.tpl index 3f132e2..829e12e 100644 --- a/templates/carnet/notif.mail.tpl +++ b/templates/carnet/notif.mail.tpl @@ -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} : +!{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 :''''' 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} diff --git a/templates/carnet/panel.tpl b/templates/carnet/panel.tpl index bde74a8..541a5da 100644 --- a/templates/carnet/panel.tpl +++ b/templates/carnet/panel.tpl @@ -51,7 +51,11 @@ Il faut pour cela se rendre sur la page de configuration {if ($promo|@count) > 1} {$notifs->_cats[$cid].mail} : {else} - {$notifs->_cats[$cid].mail_sg} : + {if $promo[0].sexe} + {$notifs->_cats[$cid].mail_sg_xette} : + {else} + {$notifs->_cats[$cid].mail_sg} : + {/if} {/if} {/foreach} {/if} diff --git a/upgrade/0.9.16/09_watch_cat.sql b/upgrade/0.9.16/09_watch_cat.sql new file mode 100644 index 0000000..7b11027 --- /dev/null +++ b/upgrade/0.9.16/09_watch_cat.sql @@ -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: -- 2.1.4