Commit | Line | Data |
---|---|---|
ee68ddc1 | 1 | #!/usr/bin/php5 -q |
0337d704 | 2 | <?php |
5ecaa68e | 3 | |
525bec1a | 4 | require 'connect.db.inc.php'; |
0337d704 | 5 | |
5ecaa68e | 6 | $message = ''; |
0337d704 | 7 | |
337a6acf SJ |
8 | $res = XDB::iterRow("SELECT a.registration_date, a.hruid, s.email |
9 | FROM accounts AS a | |
10 | INNER JOIN account_profiles AS ap ON (ap.uid = a.uid AND FIND_IN_SET('owner', ap.perms)) | |
11 | INNER JOIN profile_display AS pd ON (ap.pid = pd.pid) | |
12 | LEFT JOIN email_source_account AS s ON (a.uid = s.uid) | |
525bec1a | 13 | WHERE a.registration_date > {?} |
336820ba | 14 | GROUP BY a.hruid |
525bec1a SJ |
15 | ORDER BY pd.promo", |
16 | date("Ymd000000", strtotime('last Monday'))); | |
17 | if ($count = $res->total()) { | |
bf56938b SJ |
18 | $message .= "$count INSCRIPTIONS CONFIRMÉES CETTE SEMAINE :\n"; |
19 | while (list($date, $hruid, $email) = $res->next()) { | |
20 | $message .= "$date, $hruid, $email\n"; | |
0337d704 | 21 | } |
22 | } | |
23 | ||
bf56938b | 24 | $res = XDB::iterRow("SELECT r.date, a.hruid, r.email |
525bec1a SJ |
25 | FROM register_pending AS r |
26 | INNER JOIN accounts AS a ON (a.uid = r.uid) | |
bf56938b SJ |
27 | INNER JOIN account_profiles AS ap ON (ap.uid = a.uid AND FIND_IN_SET('owner', ap.perms)) |
28 | INNER JOIN profile_display AS pd ON (ap.pid = pd.pid) | |
525bec1a | 29 | WHERE r.hash != 'INSCRIT' |
bf56938b SJ |
30 | GROUP BY a.hruid |
31 | ORDER BY pd.promo"); | |
525bec1a SJ |
32 | if ($count = $res->total()) { |
33 | $message .= "\n$count INSCRIPTIONS NON CONFIRMÉES :\n"; | |
bf56938b SJ |
34 | while (list($date, $hruid, $email) = $res->next()) { |
35 | $message .= "$date, $hruid, $email\n"; | |
0337d704 | 36 | } |
37 | } | |
38 | ||
525bec1a SJ |
39 | $res = XDB::query('SELECT COUNT(DISTINCT uid), COUNT(*) |
40 | FROM register_marketing'); | |
0337d704 | 41 | list($a, $b) = $res->fetchOneRow(); |
bf56938b | 42 | $message .= "\nINSCRIPTIONS SOLLICITÉES :\n"; |
525bec1a | 43 | $message .= " $a utilisateurs\n $b adresses email\n"; |
0337d704 | 44 | |
525bec1a | 45 | $message .= "\n\n"; |
0337d704 | 46 | |
1e33266a | 47 | $mailer = new PlMailer(); |
525bec1a | 48 | $mailer->setSubject('Rapport des inscriptions de la semaine'); |
40bc7e89 | 49 | $mailer->setFrom($globals->register->notif); |
50 | $mailer->addTo($globals->register->notif); | |
525bec1a | 51 | $mailer->setTxtBody($message); |
0337d704 | 52 | $mailer->send(); |
5ecaa68e | 53 | |
a7de4ef7 | 54 | // vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8: |
0337d704 | 55 | ?> |