From 69834218f84372802e2cb6839e82aab7367b2975 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Rapha=C3=ABl=20Barrois?= Date: Sun, 5 Sep 2010 17:16:37 +0200 Subject: [PATCH] Fix axletter promo restriction. MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Raphaël Barrois --- include/massmailer.inc.php | 2 ++ modules/axletter/axletter.inc.php | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/include/massmailer.inc.php b/include/massmailer.inc.php index 269a570..c866f90 100644 --- a/include/massmailer.inc.php +++ b/include/massmailer.inc.php @@ -195,6 +195,8 @@ abstract class MassMailer 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"; diff --git a/modules/axletter/axletter.inc.php b/modules/axletter/axletter.inc.php index 761724c..5297ac9 100644 --- a/modules/axletter/axletter.inc.php +++ b/modules/axletter/axletter.inc.php @@ -177,10 +177,10 @@ class AXLetter extends MassMailer } $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"); -- 2.1.4