git-archimport-id: opensource@polytechnique.org--2005/platal--mainline--0.9--patch-260
$promo = (integer) (isset($_REQUEST["promo"]) ? $_REQUEST["promo"] : $_SESSION["promo"]);
$page->assign('promo', $promo);
-$page->assign('promob10', $promo-10);
-$page->assign('promob1', $promo-1);
-$page->assign('promoa1', $promo+1);
-$page->assign('promoa10', $promo+10);
-$sql = "SELECT u.nom, u.prenom, last_known_email, u.matricule, u.matricule_ax, MAX(e.date_envoi) AS dern_rel, c.email
- FROM auth_user_md5 AS u
- LEFT JOIN envoidirect AS e ON (u.matricule = e.matricule)
- LEFT JOIN en_cours AS c ON (u.matricule = c.matricule)
+$sql = "SELECT u.user_id, u.nom, u.prenom, u.last_known_email, u.matricule_ax,
+ IF(MAX(m.last)>p.relance, MAX(m.last), p.relance) AS dern_rel, p.email
+ FROM auth_user_md5 AS u
+ LEFT JOIN register_pending AS p ON p.uid = u.user_id
+ LEFT JOIN register_marketing AS m ON m.uid = u.user_id
WHERE u.promo = {?} AND u.deces = 0 AND u.perms='pending'
- GROUP BY u.matricule
- ORDER BY nom,prenom";
+ GROUP BY u.user_id
+ ORDER BY nom, prenom";
$page->assign('nonins', $globals->xdb->iterator($sql, $promo));
$page->run();
***************************************************************************/
require_once("xorg.inc.php");
-new_admin_page('marketing/envoidirect.tpl');
-
-// effacement des inscrits il y a plus de 8 jours
-$globals->xdb->execute("DELETE FROM envoidirect WHERE DATE_ADD(date_succes, INTERVAL 8 DAY) < CURRENT_DATE AND date_succes <> '0000-00-00'");
-
-$sql = "SELECT e.date_succes,e.date_envoi,a.promo,a.nom,a.prenom,e.email,b.nom as sender
- FROM envoidirect AS e
- INNER JOIN auth_user_md5 AS a ON e.matricule = a.matricule
- INNER JOIN auth_user_md5 AS b ON e.sender = b.user_id
- WHERE a.date_ins != 0
- ORDER BY e.date_envoi DESC";
+new_admin_page('marketing/recap.tpl');
+$sql = "SELECT s.success, u.promo, u.nom, u.prenom, a.alias as forlife, b.nom as sender
+ FROM register_mstats AS s
+ INNER JOIN auth_user_md5 AS u ON s.uid = u.user_id
+ INNER JOIN aliases AS a ON (s.uid = a.id AND a.type='a_vie')
+ INNER JOIN auth_user_md5 AS b ON s.sender = b.user_id
+ WHERE s.success > ".date('Ymd000000', strtotime('1 month ago'))."
+ ORDER BY s.success DESC";
$page->assign('recents', $globals->xdb->iterator($sql));
-$sql = "SELECT DISTINCT e.date_envoi, a.promo, a.nom, a.prenom, e.email, b.nom as sender
- FROM envoidirect AS e
- INNER JOIN auth_user_md5 AS a ON e.matricule = a.matricule
- INNER JOIN auth_user_md5 AS b ON e.sender = b.user_id
- WHERE a.date_ins = 0
- ORDER BY e.date_envoi DESC";
+$sql = "SELECT m.uid, MAX(m.last) AS last, COUNT(m.email) AS nb, u.promo, u.nom, u.prenom, b.nom as sender
+ FROM register_marketing AS m
+ INNER JOIN auth_user_md5 AS u ON m.uid = u.user_id
+ INNER JOIN auth_user_md5 AS b ON m.sender = b.user_id
+ WHERE m.nb > 0
+ GROUP BY m.uid
+ ORDER BY u.promo, u.nom";
$page->assign('notsub', $globals->xdb->iterator($sql));
$page->run();
$res = $globals->xdb->query('SELECT * FROM auth_user_md5 WHERE matricule={?}', Env::getInt('xmat'));
$row = $res->fetchOneAssoc();
- new_admin_page('marketing/utilisateurs_form.tpl');
+ new_admin_page('marketing/search.tpl');
$page->assign('row', $myrow);
<tr class="impair">
<td>
<span class="item">Premier contact : </span>
- <a href="utilisateurs_marketing.php">Chercher un non inscrit</a> |
+ <a href="search.php">Chercher un non inscrit</a> |
<a href="promo.php">Marketing promo</a> |
- <a href="envoidirect.php">Sollicitations faites</a>
+ <a href="recap.php">Sollicitations faites</a>
</td>
</tr>
<tr class="pair">
<table style="margin-left: auto; margin-right: auto">
<tr>
<td>
- <form action="{$smarty.server.PHP_SELF}" method="post">
+ <form action="?" method="get">
<div>
- <input type="hidden" name="promo" value="{$promob10}" />
+ <input type="hidden" name="promo" value="{$promo-10}" />
<input type="submit" value="<<" />
</div>
</form>
</td>
<td>
- <form action="{$smarty.server.PHP_SELF}" method="post">
+ <form action="?" method="get">
<div>
- <input type="hidden" name="promo" value="{$promob1}" />
+ <input type="hidden" name="promo" value="{$promo-1}" />
<input type="submit" value="<" />
</div>
</form>
</td>
<td>
- <form action="{$smarty.server.PHP_SELF}" method="post">
+ <form action="?" method="get">
<div>
Promotion : <input type="text" name="promo" value="{$promo}" size="4" maxlength="4" />
<input type="submit" value="GO" />
</form>
</td>
<td>
- <form action="{$smarty.server.PHP_SELF}" method="post">
+ <form action="?" method="get">
<div>
- <input type="hidden" name="promo" value="{$promoa1}" />
+ <input type="hidden" name="promo" value="{$promo+1}" />
<input type="submit" value=">" />
</div>
</form>
</td>
<td>
- <form action="{$smarty.server.PHP_SELF}" method="post">
+ <form action="?" method="get">
<div>
- <input type="hidden" name="promo" value="{$promoa10}" />
+ <input type="hidden" name="promo" value="{$promo+10}" />
<input type="submit" value=">>" />
</div>
</form>
<tr>
<th>Nom</th>
<th>Dernière adresse connue</th>
- <th>Date dernière relance<br />(si moins d'un an)</th>
+ <th>Statut</th>
+ <th>AX</th>
<th> </th>
</tr>
{iterate from=$nonins item=it}
<tr class="{cycle values="pair,impair"}">
<td>{$it.nom} {$it.prenom}</td>
- <td class="center">{if $it.last_known_email}{mailto address=$it.last_known_email}{/if}</td>
+ <td>{if $it.last_known_email}{mailto address=$it.last_known_email}{/if}</td>
<td class="center">
- {if $it.dern_rel}
- {$it.dern_rel}
+ {if $it.dern_rel && $it.dern_rel != '0000-00-00'}
+ Relance le: {$it.dern_rel}
{elseif $it.email}
- Ins en cours depuis {$it.email}
+ En cours : {$it.email}
{else}
- Jamais ou + d'1 an
+ -
{/if}
</td>
<td class="center">
- <a href="http://www.polytechniciens.com/index.php?page=AX_FICHE_ANCIEN&anc_id={$it.matricule_ax}">Fiche AX</a>/
- <a href="utilisateurs_marketing.php?xmat={$it.matricule}">Marketing</a>
+ <a href="http://www.polytechniciens.com/index.php?page=AX_FICHE_ANCIEN&anc_id={$it.matricule_ax}">{*
+ *}<img src="{rel}/images/ax.png" alt='AX' title="fiche AX" /></a>
+ </td>
+ <td>
+ <a href="utilisateurs_marketing.php?xmat={$it.user_id}">Marketing</a>
</td>
</tr>
{/iterate}
<table class="bicol" summary="liste des sollicités inscrits">
<tr>
- <th>Date</th>
+ <th>Date Ins.</th>
<th>Par</th>
<th>Nom</th>
<th>inscription</th>
</tr>
{iterate from=$recents item=it}
<tr class="{cycle values="pair,impair"}">
- <td>{$it.date_envoi|date_format}</td>
- <td>{$it.sender|lower|truncate:8:""}</td>
+ <td>{$it.success|date_format}</td>
+ <td>{$it.sender|lower}</td>
<td>
- <a href="mailto:{$it.email}" title="{$it.email}">{$it.nom} {$it.prenom}</a>
- (x<a href="promo.php?promo={$it.promo}">{$it.promo}</a>)
+ <a href="{rel}/fiche.php?user={$it.forlife}" class="popup2">{$it.prenom} {$it.nom}</a>
+ (<a href="promo.php?promo={$it.promo}">{$it.promo}</a>)
</td>
<td>{$it.date_succes|date_format}</td>
</tr>
<table class="bicol" summary="liste des sollicités non inscrits">
<tr>
- <th>Date</th>
+ <th>Dernier envoi</th>
<th>Par</th>
<th>Nom</th>
+ <th>Nb mails testés</th>
</tr>
- {iterate from=$notsub item=it}
+ {iterate from=$notsub item=x}
<tr class="{cycle values="pair,impair"}">
- <td>{$it.date_envoi|date_format}</td>
- <td>{$it.sender|lower|truncate:8:""}</td>
+ <td class="center">
+ {if $x.last != '0000-00-00'}{$x.last|date_format:"%d %b %y"}{else}-{/if}
+ </td>
+ <td>{$x.sender|lower}</td>
+ <td>
+ {$x.promo} {$x.nom} {$x.prenom}
+ </td>
<td>
- <a href="mailto:{$it.email}" title="{$it.email}">{$it.nom} {$it.prenom}</a>
- (x<a href="promo.php?promo={$it.promo}">{$it.promo}</a>)
+ {$x.nb}
</td>
</tr>
{/iterate}
-<h1>
- Envoyer un mail de pré-inscription
-</h1>
+<h1>Envoyer un mail de pré-inscription</h1>
<p>
Le nom, prénom et promotion sont pris dans la table d'identification. Le login sera automatiquement
last date not null default '0000-00-00',
nb tinyint not null default 0,
type set('user', 'staff') not null default 'user',
- INDEX (uid),
+ hash char(32) not null,
+ PRIMARY KEY (uid, email),
INDEX (date),
INDEX (last),
INDEX (nb)
success date not null default '0000-00-00',
PRIMARY KEY (uid)
);
-
+
+
+--
+-- envoidirect -> register_mstats
+--
+
+insert into register_mstats (uid, sender, success)
+ select u.user_id, e.sender, u.date_ins
+ from envoidirect as e
+ inner join auth_user_md5 as u using(matricule)
+ where u.date_ins != 0;
+
+insert into register_marketing (uid, sender, email, date, last, nb, type, hash)
+ select u.user_id, m.expe, m.email, 0, 0, FIND_IN_SET('envoye', m.flags), IF(FIND_IN_SET('mail_perso', m.flags), 'user', 'staff'), ''
+ from marketing as m
+ inner join auth_user_md5 as u on u.matricule = m.dest
+ where date_ins = 0 and deces = 0
+ group by user_id, m.email;
+
+replace into register_marketing (uid, sender, email, date, last, nb, type, hash)
+ select u.user_id, e.sender, e.email, date_envoi, date_envoi, 1, 'staff', e.uid
+ from envoidirect as e
+ inner join auth_user_md5 as u using(matricule)
+ where date_ins = 0 and deces = 0;
+
+drop table envoidirect;
+drop table marketing;