WHERE flags = \'active\' AND broken_level = 1
AND DATE_ADD(last, INTERVAL 1 YEAR) < CURDATE()');
+ // Sort $broken_user_list with (promo, sortname, pid)
+ $sortable_array = array();
+ foreach ($broken_user_list as $pid => $mails) {
+ $profile = $broken_user_profiles[$pid];
+ $sortable_array[$pid] = array($profile->promo(), $profile->sortName(), $pid);
+ }
+ asort($sortable_array);
+
// Output the list of users with recently broken addresses,
// along with the count of valid redirections.
pl_cached_content_headers('text/x-csv', 1);
$csv = fopen('php://output', 'w');
fputcsv($csv, array('nom', 'promo', 'bounces', 'nbmails', 'url', 'corps', 'job', 'networking'), ';');
$corpsList = DirEnum::getOptions(DirEnum::CURRENTCORPS);
- foreach ($broken_user_list as $pid => $mails) {
+ foreach (array_keys($sortable_array) as $pid) {
+ $mails = $broken_user_list[$pid];
$profile = $broken_user_profiles[$pid];
$current_corps = $profile->getCorpsName();
$jobs = $profile->getJobs();