CIVICRM-1638 When two contacts, Contact A and Contact B have the same email address...
authorJustin Freeman <justin@agileware.com.au>
Mon, 11 Jan 2021 05:42:09 +0000 (16:42 +1100)
committerJustin Freeman <justin@agileware.com.au>
Mon, 11 Jan 2021 05:51:47 +0000 (16:51 +1100)
CRM/Mailing/BAO/Mailing.php

index b2484335d681dacd8f1f6a0e1ed3051040905b61..269bf3d8ea09b20c4a6a36feda4ecd474fc20b5a 100644 (file)
@@ -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"),