From 1552905b69145263567200717773cc65d20bbdf4 Mon Sep 17 00:00:00 2001 From: "Pierre Habouzit (MadCoder" Date: Sun, 16 Jan 2005 17:36:55 +0000 Subject: [PATCH] update notifs to the new semantics notifs are known a posteriori or a priori. for /a priori ones/ we want the hilight to be enabled the good day (TM) git-archimport-id: opensource@polytechnique.org--2005/platal--mainline--0.9--patch-357 --- bin/cron/notifs.birthday.php | 6 +++--- htdocs/carnet/panel.php | 3 ++- include/notifs.inc.php | 2 +- templates/carnet/panel.tpl | 2 +- upgrade/0.9.4/60_watch.sql | 7 ++++--- 5 files changed, 11 insertions(+), 9 deletions(-) diff --git a/bin/cron/notifs.birthday.php b/bin/cron/notifs.birthday.php index 7c99e50..e2c10fb 100755 --- a/bin/cron/notifs.birthday.php +++ b/bin/cron/notifs.birthday.php @@ -22,12 +22,12 @@ require('./connect.db.inc.php'); -$date = date('Y-m-d'); +$date = date('Y-m-d', time() + 7 * 24*60*60); $stamp = date('Ymd000000'); -$like = date('%-m-d'); +$like = date('%-m-d', time() + 7 * 24*60*60); $globals->db->query("INSERT INTO watch_ops (uid, cid, known, date) - SELECT user_id, 4, '$date', $stamp + SELECT user_id, 4, $stamp, '$date' FROM auth_user_md5 WHERE naissance LIKE '$like'"); diff --git a/htdocs/carnet/panel.php b/htdocs/carnet/panel.php index 3b91262..3abeb82 100644 --- a/htdocs/carnet/panel.php +++ b/htdocs/carnet/panel.php @@ -31,7 +31,8 @@ if(Get::has('read')) { $page->assign('now',date('YmdHis')); $notifs = new Notifs(Session::getInt('uid'), true); -$page->assign_by_ref('notifs', $notifs); +$page->assign('notifs', $notifs); +$page->assign('today', date('Y-m-d')); $page->run(); diff --git a/include/notifs.inc.php b/include/notifs.inc.php index 1242057..b9167c4 100644 --- a/include/notifs.inc.php +++ b/include/notifs.inc.php @@ -103,7 +103,7 @@ function _select_notifs_base($table, $mail, $where) } $sql .=" - INNER JOIN watch_ops AS wo ON(wo.uid = u.user_id AND wo.known > ".($mail ? 'q.watch_last' : '{?}').") + INNER JOIN watch_ops AS wo ON(wo.uid = u.user_id AND ".($mail ? 'wo.known > q.watch_last' : '( wo.known > {?} OR wo.date=NOW() )').") INNER JOIN watch_sub AS ws ON(ws.cid = wo.cid AND ws.uid = w.uid) INNER JOIN watch_cat AS wc ON(wc.id = wo.cid{$our['freq_sql']}) LEFT JOIN aliases AS a ON(a.id = u.user_id AND FIND_IN_SET('bestalias', a.flags)) diff --git a/templates/carnet/panel.tpl b/templates/carnet/panel.tpl index 49a3c9e..f174198 100644 --- a/templates/carnet/panel.tpl +++ b/templates/carnet/panel.tpl @@ -54,7 +54,7 @@ Il faut pour cel {foreach from=$c key=p item=promo} {section name=row loop=$promo} - $smarty.session.watch_last}style="font-weight: bold"{/if}> + $smarty.session.watch_last ) || ( $promo[row].date eq $today ) }style="font-weight: bold"{/if}>
{if $smarty.section.row.first}{$p}{/if} {if $promo[row].inscrit} diff --git a/upgrade/0.9.4/60_watch.sql b/upgrade/0.9.4/60_watch.sql index e8e4c99..bdbb273 100644 --- a/upgrade/0.9.4/60_watch.sql +++ b/upgrade/0.9.4/60_watch.sql @@ -1,12 +1,13 @@ alter table watch_cat add column type enum('basic', 'near', 'often') not null default 'basic'; update watch_cat set type='often' where frequent=1; alter table watch_cat drop column frequent; -insert into watch_cat (id, short, mail, type) values(4, 'Anniversaires', 'Ces camarades ont fêté leur anniversaire cette semaine', 'near'); -replace into watch_sub (uid, cid) select user_id, 4 from auth_user_md5 where perms in ('admin', 'user') and deces=0; alter table watch_cat add mail_sg varchar(80) default NULL after mail; update watch_cat set mail_sg = 'Ce camarade a mis sa fiche à jour' where id = 1; update watch_cat set mail_sg = 'Ce camarade s\'est inscrit' where id = 2; update watch_cat set mail_sg = 'Ce camarade nous a quitté' where id = 3; -update watch_cat set mail_sg = 'Ce camarade a fêté son anniversaire la semaine dernère' where id = 4; + +insert into watch_cat (id, short, mail, mail_sg, type) + values(4, 'Anniversaires', 'Ces camarades fêtent leur anniversaire cette semaine', 'Ce camarade fête son anniversaire cette semaine', 'near'); +replace into watch_sub (uid, cid) select user_id, 4 from auth_user_md5 where perms in ('admin', 'user') and deces=0; -- 2.1.4