From 2cf4876c0dc3a876b1d3054ebca11df853c9fd33 Mon Sep 17 00:00:00 2001 From: Seamus Lee Date: Tue, 20 Mar 2018 14:02:08 +1100 Subject: [PATCH] Dev/Core 25 Wrap the mailing split_job function in a transaction to ensure that there is no possibility of duplicate maiing jobs created Include the split_jobs in the transaction used to update the parent job --- CRM/Mailing/BAO/MailingJob.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/CRM/Mailing/BAO/MailingJob.php b/CRM/Mailing/BAO/MailingJob.php index 0d49819d6408..d86815a7a4a4 100644 --- a/CRM/Mailing/BAO/MailingJob.php +++ b/CRM/Mailing/BAO/MailingJob.php @@ -375,11 +375,11 @@ public static function runJobs_pre($offset = 200, $mode = NULL) { continue; } + $transaction = new CRM_Core_Transaction(); + $job->split_job($offset); // update the status of the parent job - $transaction = new CRM_Core_Transaction(); - $saveJob = new CRM_Mailing_DAO_MailingJob(); $saveJob->id = $job->id; $saveJob->start_date = date('YmdHis'); @@ -437,6 +437,7 @@ public function split_job($offset = 200) { CRM_Core_DAO::executeQuery($sql, $params); } } + } /**