From fa6d0f5ae06d7f6832feab172b241a2c53419720 Mon Sep 17 00:00:00 2001 From: Jamie McClelland Date: Tue, 14 Oct 2014 13:09:08 -0400 Subject: [PATCH] CRM-15455 - avoid creating dupes and using deleted contacts in test mailings. ---------------------------------------- * CRM-15455: email tests do not properly replace tokens https://issues.civicrm.org/jira/browse/CRM-15455 --- CRM/Mailing/Form/Test.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/CRM/Mailing/Form/Test.php b/CRM/Mailing/Form/Test.php index ff9650946c..677de42610 100644 --- a/CRM/Mailing/Form/Test.php +++ b/CRM/Mailing/Form/Test.php @@ -289,6 +289,7 @@ WHERE e.email IN ($emails) AND e.on_hold = 0 AND c.is_opt_out = 0 AND c.do_not_email = 0 +AND c.is_deleted = 0 AND c.is_deceased = 0 GROUP BY e.id ORDER BY e.is_bulkmail DESC, e.is_primary DESC @@ -306,7 +307,9 @@ ORDER BY e.is_bulkmail DESC, e.is_primary DESC $dao->free(); foreach ($testParams['emails'] as $key => $email) { - $email = trim($email); + // Email addresses are forced to lower case when saved, so ensure + // we have the same case when comparing. + $email = trim(strtolower($email)); $contactId = $emailId = NULL; if (array_key_exists($email, $emailDetail)) { $emailId = $emailDetail[$email]['email_id']; -- 2.25.1