- $res = XDB::iterator(
- "SELECT a.alias AS homonyme, s.alias AS forlife,
- IF(h.homonyme_id = s.uid, a.expire, NULL) AS expire,
- IF(h.homonyme_id = s.uid, a.type, NULL) AS type, ac.uid
- FROM aliases AS a
- LEFT JOIN homonyms AS h ON (h.homonyme_id = a.uid)
- INNER JOIN aliases AS s ON (s.uid = h.uid AND s.type = 'a_vie')
- INNER JOIN accounts AS ac ON (ac.uid = a.uid)
- WHERE a.type = 'homonyme' OR a.expire != ''
- ORDER BY a.alias, forlife");
- $hnymes = Array();
- while ($tab = $res->next()) {
- $hnymes[$tab['homonyme']][] = $tab;
- }
- $page->assign_by_ref('hnymes', $hnymes);
+ // Retrieves homonyms that are already been fixed.
+ $res = XDB::iterator('SELECT o.email AS homonym, f.email AS forlife, o.expire, f.uid
+ FROM email_source_other AS o
+ INNER JOIN homonyms_list AS h ON (o.hrmid = h.hrmid)
+ INNER JOIN email_source_account AS f ON (h.uid = f.uid AND f.type = \'forlife\')
+ INNER JOIN email_virtual_domains AS d ON (f.domain = d.id)
+ WHERE o.expire IS NOT NULL AND d.name = {?}
+ ORDER BY homonym, forlife',
+ $globals->mail->domain);
+ $homonyms = array();
+ while ($item = $res->next()) {
+ $homonyms[$item['homonym']][] = $item;
+ }
+ $page->assign_by_ref('homonyms', $homonyms);
+
+ // Retrieves homonyms that needs to be fixed.
+ $res = XDB::iterator('SELECT e.email AS homonym, f.email AS forlife, e.expire, e.uid, (e.expire < NOW()) AS urgent
+ FROM email_source_account AS e
+ INNER JOIN homonyms_list AS l ON (e.uid = l.uid)
+ INNER JOIN homonyms_list AS h ON (l.hrmid = h.hrmid)
+ INNER JOIN email_source_account AS f ON (h.uid = f.uid AND f.type = \'forlife\')
+ INNER JOIN email_virtual_domains AS d ON (f.domain = d.id)
+ WHERE e.expire IS NOT NULL AND d.name = {?}
+ ORDER BY homonym, forlife',
+ $globals->mail->domain);
+ $homonyms_to_fix = array();
+ while ($item = $res->next()) {
+ $homonyms_to_fix[$item['homonym']][] = $item;
+ }
+ $page->assign_by_ref('homonyms_to_fix', $homonyms_to_fix);