and now, a 4 line change to add Birthdays !!!!
authorPierre Habouzit (MadCoder <pierre.habouzit@m4x.org>
Fri, 14 Jan 2005 23:54:51 +0000 (23:54 +0000)
committerFlorent Bruneau <florent.bruneau@polytechnique.org>
Thu, 26 Jun 2008 21:27:34 +0000 (23:27 +0200)
git-archimport-id: opensource@polytechnique.org--2005/platal--mainline--0.9--patch-323

include/notifs.inc.php
upgrade/0.9.4/60_watch.sql [new file with mode: 0644]

index d080b0d..4842ce2 100644 (file)
  *  59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                *
  ***************************************************************************/
 
-define("WATCH_FICHE", 1);
-define("WATCH_INSCR", 2);
-define("WATCH_DEATH", 3);
+define('WATCH_FICHE', 1);
+define('WATCH_INSCR', 2);
+define('WATCH_DEATH', 3);
+define('WATCH_BIRTH', 4);
 
 // {{{ function inscription_notifs_base
 
@@ -64,7 +65,7 @@ function _select_notifs_base($table, $mail, $where)
                 'contact_sql' => '1'
             ),
             'watch_promo'  => Array('wfield' => 'promo',   'ufield' => 'promo',   'need_contact' => true,
-                'freq_sql' => ' AND wc.frequent=0',
+                'freq_sql' => ' AND ( wc.type = "basic" OR wc.type="near" AND (w.promo <= u.promo+1 AND w.promo >= u.promo-1) )',
                 'contact_sql' => 'NOT (c.contact IS NULL)'
             ),
             'watch_nonins' => Array('wfield' => 'ni_id',   'ufield' => 'user_id', 'need_contact' => false,
diff --git a/upgrade/0.9.4/60_watch.sql b/upgrade/0.9.4/60_watch.sql
new file mode 100644 (file)
index 0000000..44cb1f7
--- /dev/null
@@ -0,0 +1,4 @@
+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 feté leur anniversaire cette semaine', 'near');