From e45a9f86de2baa5c038a83a8f27679caa944801a Mon Sep 17 00:00:00 2001 From: Justin Freeman Date: Mon, 11 Jan 2021 16:42:09 +1100 Subject: [PATCH] CIVICRM-1638 When two contacts, Contact A and Contact B have the same email address, if Contact A is deleted then Contact B is incorrectly excluded from mailings, does not receive emails --- CRM/Mailing/BAO/Mailing.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/CRM/Mailing/BAO/Mailing.php b/CRM/Mailing/BAO/Mailing.php index b2484335d6..269bf3d8ea 100644 --- a/CRM/Mailing/BAO/Mailing.php +++ b/CRM/Mailing/BAO/Mailing.php @@ -221,6 +221,7 @@ class CRM_Mailing_BAO_Mailing extends CRM_Mailing_DAO_Mailing { if ($isSMSmode) { $criteria = [ + 'is_deleted' => CRM_Utils_SQL_Select::fragment()->where("$contact.is_deleted = 0"), 'is_opt_out' => CRM_Utils_SQL_Select::fragment()->where("$contact.is_opt_out = 0"), 'is_deceased' => CRM_Utils_SQL_Select::fragment()->where("$contact.is_deceased <> 1"), 'do_not_sms' => CRM_Utils_SQL_Select::fragment()->where("$contact.do_not_sms = 0"), @@ -233,8 +234,9 @@ class CRM_Mailing_BAO_Mailing extends CRM_Mailing_DAO_Mailing { ]; } else { - // Criterias to filter recipients that need to be included + // Criteria to filter recipients that need to be included $criteria = [ + 'is_deleted' => CRM_Utils_SQL_Select::fragment()->where("$contact.is_deleted = 0"), 'do_not_email' => CRM_Utils_SQL_Select::fragment()->where("$contact.do_not_email = 0"), 'is_opt_out' => CRM_Utils_SQL_Select::fragment()->where("$contact.is_opt_out = 0"), 'is_deceased' => CRM_Utils_SQL_Select::fragment()->where("$contact.is_deceased <> 1"), -- 2.25.1