Merge commit 'origin/master' into fusionax
[platal.git] / include / marketing.inc.php
index d488843..7a53989 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 /***************************************************************************
- *  Copyright (C) 2003-2008 Polytechnique.org                              *
+ *  Copyright (C) 2003-2009 Polytechnique.org                              *
  *  http://opensource.polytechnique.org/                                   *
  *                                                                         *
  *  This program is free software; you can redistribute it and/or modify   *
@@ -197,7 +197,9 @@ class Marketing
         $res = XDB::query("SELECT  r.date, u.promo, u.nom, u.prenom, r.email, r.bestalias
                              FROM  register_pending AS r
                        INNER JOIN  auth_user_md5    AS u ON u.user_id = r.uid
-                            WHERE  hash!='INSCRIT' AND uid={?} AND TO_DAYS(relance) < TO_DAYS(NOW())", $uid);
+                            WHERE  hash != 'INSCRIT' AND uid = {?} AND
+                                   (TO_DAYS(relance) IS NULL OR TO_DAYS(relance) < TO_DAYS(NOW()))",
+                          $uid);
         if (!list($date, $promo, $nom, $prenom, $email, $alias) = $res->fetchOneRow()) {
             return false;
         }
@@ -220,7 +222,7 @@ class Marketing
         $mymail->send();
         XDB::execute('UPDATE  register_pending
                          SET  hash={?}, password={?}, relance=NOW()
-                       WHERE uid={?}', $hash, $pass_encrypted, $uid);
+                       WHERE  uid={?}', $hash, $pass_encrypted, $uid);
         return "$prenom $nom ($promo)";
     }
 }