X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;f=bin%2Fcron%2Frapports_inscription.php;h=880058440a15672516c7b6e987160da3daeb35f9;hb=93b0da52bfae596573e07fb4b8fe5a3326326179;hp=c9d09fdba732a01eba8d2783db30eba6956ceeab;hpb=08cce2ff528b38bde27cdec6d6bc28d6af4a42d4;p=platal.git diff --git a/bin/cron/rapports_inscription.php b/bin/cron/rapports_inscription.php index c9d09fd..8800584 100755 --- a/bin/cron/rapports_inscription.php +++ b/bin/cron/rapports_inscription.php @@ -1,56 +1,58 @@ -#!/usr/bin/php4 -q +#!/usr/bin/php5 -q {?} - GROUP BY alias - ORDER BY promo", date("Ymd000000", strtotime ("last Monday"))); -if ($a = $res->total()) { - $MESSAGE.="$a INSCRIPTIONS CONFIRMEES:\n"; - while (list($usern,$promo,$mail) = $res->next()) { - $MESSAGE.="X$promo, $usern, $mail\n"; +$res = XDB::iterRow("SELECT al.alias, pd.promo, e.email //a.alias, u.promo, email + FROM accounts AS a + INNER JOIN account_profile AS ap ON (ap.uid = a.uid AND FIND_IN_SET('owner', ap.perms)) + INNER JOIN profile_display AS pd ON (ap.pid = pd.pid) + LEFT JOIN aliases AS al ON (a.uid =a.uid AND al.type = 'a_vie') + LEFT JOIN emails AS e ON (a.uid = e.uid AND NOT FIND_IN_SET('filter', e.flags)) + WHERE a.registration_date > {?} + GROUP BY al.alias + ORDER BY pd.promo", + date("Ymd000000", strtotime('last Monday'))); +if ($count = $res->total()) { + $message .= "$count INSCRIPTIONS CONFIRMÉES :\n"; + while (list($forlife, $promo, $email) = $res->next()) { + $message .= "$promo, $forlife, $email\n"; } } // --------------------------------------- -$res = XDB::iterRow( - "SELECT forlife, email, date - FROM register_pending - WHERE hash != 'INSCRIT' - ORDER BY date"); -if ($b = $res->total()) { - $MESSAGE.="\n$b INSCRIPTIONS NON CONFIRMEES:\n"; - while (list($usern, $mail, $quand) = $res->next()) { - $MESSAGE.="$quand, $usern,\n $mail\n"; +$res = XDB::iterRow("SELECT a.hruid, r.email, r.date + FROM register_pending AS r + INNER JOIN accounts AS a ON (a.uid = r.uid) + WHERE r.hash != 'INSCRIT' + ORDER BY r.date"); +if ($count = $res->total()) { + $message .= "\n$count INSCRIPTIONS NON CONFIRMÉES :\n"; + while (list($forlife, $email, $date) = $res->next()) { + $message .= "$date, $forlife,\n $email\n"; } } // --------------------------------------- -$res = XDB::query('SELECT COUNT(DISTINCT uid), COUNT(*) FROM register_marketing'); +$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"; +$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->setTxtBody($MESSAGE); +$mailer = new PlMailer(); +$mailer->setSubject('Rapport des inscriptions de la semaine'); +$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: ?>