From 85d207529b212447309ce73bb0c3fbf0977a183e Mon Sep 17 00:00:00 2001 From: Tim Otten Date: Fri, 15 May 2015 12:56:20 -0700 Subject: [PATCH] CRM-16465 - Mailing BAO - Handle dedupe_email --- CRM/Mailing/BAO/Mailing.php | 2 +- CRM/Mailing/BAO/MailingJob.php | 10 ++++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/CRM/Mailing/BAO/Mailing.php b/CRM/Mailing/BAO/Mailing.php index a0c7b9176e..6719cae641 100644 --- a/CRM/Mailing/BAO/Mailing.php +++ b/CRM/Mailing/BAO/Mailing.php @@ -1752,7 +1752,7 @@ ORDER BY civicrm_email.is_bulkmail DESC // Populate the recipients. if (empty($params['_skip_evil_bao_auto_recipients_'])) { - self::getRecipients($job->id, $mailing->id, NULL, NULL, TRUE, FALSE); + self::getRecipients($job->id, $mailing->id, NULL, NULL, TRUE, $mailing->dedupe_email); } } diff --git a/CRM/Mailing/BAO/MailingJob.php b/CRM/Mailing/BAO/MailingJob.php index e810c17146..47b461948b 100644 --- a/CRM/Mailing/BAO/MailingJob.php +++ b/CRM/Mailing/BAO/MailingJob.php @@ -69,8 +69,14 @@ class CRM_Mailing_BAO_MailingJob extends CRM_Mailing_DAO_MailingJob { $job->is_test = $params['is_test']; $job->save(); $mailing = new CRM_Mailing_BAO_Mailing(); - $mailing->getRecipients($job->id, $params['mailing_id'], NULL, NULL, TRUE, FALSE); - return $job; + $mailing->id = $params['mailing_id']; + if ($mailing->id && $mailing->find(TRUE)) { + $mailing->getRecipients($job->id, $params['mailing_id'], NULL, NULL, TRUE, $mailing->dedupe_email); + return $job; + } + else { + throw new CRM_Core_Exception("Failed to create job: Unknown mailing ID"); + } } /** -- 2.25.1