Fixes calls to auth_user_* from marketPromo.php
[platal.git] / bin / cron / rapports_inscription.php
index c9d09fd..4059445 100755 (executable)
@@ -1,6 +1,6 @@
-#!/usr/bin/php4 -q
+#!/usr/bin/php5 -q
 <?php
-require('./connect.db.inc.php');
+require('connect.db.inc.php');
 $MESSAGE = '';
 
 // ---------------------------------------
@@ -8,7 +8,7 @@ $MESSAGE = '';
 $res = XDB::iterRow(
         "SELECT  a.alias, u.promo, email
            FROM  auth_user_md5  AS u
-      LEFT JOIN  aliases        AS a ON( u.user_id=a.id AND a.type='a_vie' )
+      LEFT JOIN  aliases        AS a ON( u.user_id=a.uid AND a.type='a_vie' )
       LEFT JOIN  emails         AS e ON( e.uid = u.user_id AND NOT FIND_IN_SET('filter',e.flags) )
           WHERE  u.date_ins > {?}
        GROUP BY  alias
@@ -23,10 +23,11 @@ if ($a = $res->total()) {
 // ---------------------------------------
 
 $res = XDB::iterRow(
-        "SELECT  forlife, email, date
-           FROM  register_pending
-          WHERE  hash != 'INSCRIT'
-       ORDER BY  date");
+        "SELECT  u.hruid, r.email, r.date
+           FROM  register_pending AS r
+      LEFT JOIN  auth_user_md5 AS u ON (u.user_id = r.uid)
+          WHERE  r.hash != 'INSCRIT'
+       ORDER BY  r.date");
 if ($b = $res->total()) {
     $MESSAGE.="\n$b INSCRIPTIONS NON CONFIRMEES:\n";
     while (list($usern, $mail, $quand) = $res->next()) {       
@@ -38,19 +39,18 @@ if ($b = $res->total()) {
 
 $res = XDB::query('SELECT COUNT(DISTINCT uid), COUNT(*) FROM register_marketing');
 list($a, $b) = $res->fetchOneRow();
-$MESSAGE .= "\n$c INSCRIPTIONS SOLICITÉES :\n";
-$MESSAGE .= "    $a utilisateurs\n    $b adresses mails\n";
+$MESSAGE .= "\nINSCRIPTIONS SOLICITÉES :\n";
+$MESSAGE .= "    $a utilisateurs\n    $b adresses email\n";
 
 // ---------------------------------------
 
 $MESSAGE .= "\n\n";
 
-require_once('diogenes/diogenes.hermes.inc.php');
-$mailer = new HermesMailer();
-$mailer->setSubject("$a confirmées, $b en attente et $c sollicitées");
-$mailer->setFrom('register@polytechnique.org');
-$mailer->addTo('register@polytechnique.org');
-$mailer->addCc('jean-michel.yolin+register@polytechnique.org');
+$mailer = new PlMailer();
+$mailer->setSubject("$a confirmées, $b en attente et $c sollicitées");
+$mailer->setFrom($globals->register->notif);
+$mailer->addTo($globals->register->notif);
 $mailer->setTxtBody($MESSAGE);
 $mailer->send();
+// vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8:
 ?>