Signed-off-by: Raphaël Barrois <raphael.barrois@polytechnique.org>
INNER JOIN accounts AS a ON (ni.uid = a.uid)
LEFT JOIN email_options AS eo ON (eo.uid = a.uid)
LEFT JOIN emails AS e ON (e.uid = a.uid AND e.flags='active')
+ LEFT JOIN account_profiles AS ap ON (a.uid = ap.uid AND FIND_IN_SET('owner', ap.perms))
+ LEFT JOIN profile_display AS pd ON (ap.pid = pd.pid)
WHERE ni.last < {?} AND ({$this->subscriptionWhere()}) AND
(e.email IS NOT NULL OR FIND_IN_SET('googleapps', eo.storage))
GROUP BY a.uid";
}
$where = array();
if ($this->_promo_min) {
- $where[] = "((ni.uid = 0 AND ni.promo >= {$this->_promo_min}) OR (ni.uid != 0 AND u.promo >= {$this->_promo_min}))";
+ $where[] = "((ni.uid = 0 AND ni.promo >= {$this->_promo_min}) OR (ni.uid != 0 AND pd.promo >= 'X{$this->_promo_min}'))";
}
if ($this->_promo_max) {
- $where[] = "((ni.uid = 0 AND ni.promo <= {$this->_promo_max}) OR (ni.uid != 0 AND u.promo <= {$this->_promo_max}))";
+ $where[] = "((ni.uid = 0 AND ni.promo <= {$this->_promo_max}) OR (ni.uid != 0 AND pd.promo <= 'X{$this->_promo_max}'))";
}
if ($this->_subset) {
require_once("emails.inc.php");