Handles canceled payment transactions.
[platal.git] / bin / cron / homonyms.php
index 6de61bc..e4e9db0 100755 (executable)
@@ -1,7 +1,7 @@
 #!/usr/bin/php5 -q
 <?php
 /***************************************************************************
- *  Copyright (C) 2003-2010 Polytechnique.org                              *
+ *  Copyright (C) 2003-2014 Polytechnique.org                              *
  *  http://opensource.polytechnique.org/                                   *
  *                                                                         *
  *  This program is free software; you can redistribute it and/or modify   *
  ***************************************************************************/
 
 /**
- * Requires destruction of aliases: a first notification 10 days before
+ * Requires destruction of aliases: a first notification 7 days before
  * destruction, a second on the date.
  */
 require 'connect.db.inc.php';
 
-$resRobot = XDB::iterator("SELECT  uid, alias, expire
-                             FROM  aliases
-                            WHERE  (expire = NOW() + INTERVAL 7 DAY OR expire <= NOW())
-                                   AND type = 'alias'");
+$resRobot = XDB::iterator("SELECT  uid, email, expire
+                             FROM  email_source_account
+                            WHERE  expire <= NOW() + INTERVAL 7 DAY");
 while ($old = $resRobot->next()) {
     $res = XDB::query('SELECT  a.hruid
-                         FROM  homonyms AS h
-                   INNER JOIN  accounts AS a ON (h.uid = a.uid)
-                        WHERE  homonyme_id = {?}',
-                      $old['id']);
+                         FROM  homonyms_list AS h
+                   INNER JOIN  accounts      AS a ON (h.uid = a.uid)
+                        WHERE  h.hrmid = {?}',
+                      User::makeHomonymHrmid($old['email']));
     $hruids = $res->fetchColumn();
 
-    $homonym = User::getSilent($old['id']);
-    $req = new HomonymeReq($homonym, $old['alias'], $hruids, $old['expire'] > date("Y-m-d"));
+    $homonym = User::getSilent($old['uid']);
+    $req = new HomonymeReq($homonym, $old['email'], $hruids, $old['expire'] > date("Y-m-d"));
     $req->submit();
 }
 
-// vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8:
+// vim:set et sw=4 sts=4 sws=4 foldmethod=marker fenc=utf-8:
 ?>