update notifs to the new semantics
authorPierre Habouzit (MadCoder <pierre.habouzit@m4x.org>
Sun, 16 Jan 2005 17:36:55 +0000 (17:36 +0000)
committerFlorent Bruneau <florent.bruneau@polytechnique.org>
Thu, 26 Jun 2008 21:27:42 +0000 (23:27 +0200)
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
htdocs/carnet/panel.php
include/notifs.inc.php
templates/carnet/panel.tpl
upgrade/0.9.4/60_watch.sql

index 7c99e50..e2c10fb 100755 (executable)
 
 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'");
 
index 3b91262..3abeb82 100644 (file)
@@ -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();
 
index 1242057..b9167c4 100644 (file)
@@ -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))
index 49a3c9e..f174198 100644 (file)
@@ -54,7 +54,7 @@ Il faut pour cel
 <table class='tinybicol'>
   {foreach from=$c key=p item=promo}
   {section name=row loop=$promo}
-  <tr {if $promo[row].known > $smarty.session.watch_last}style="font-weight: bold"{/if}>
+  <tr {if ( $promo[row].known > $smarty.session.watch_last ) || ( $promo[row].date eq $today ) }style="font-weight: bold"{/if}>
     <td class='titre' style="width:15%">{if $smarty.section.row.first}{$p}{/if}</td>
     <td>
       {if $promo[row].inscrit}
index e8e4c99..bdbb273 100644 (file)
@@ -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;