From 8817ccc5148e0f224ab9ad8a0932c468fa88397a Mon Sep 17 00:00:00 2001 From: Brian Shaughnessy Date: Thu, 14 Nov 2013 20:24:07 -0500 Subject: [PATCH] CRM-13766 set scheduled date in params after approval --- CRM/Mailing/Form/Approve.php | 7 +++++++ CRM/Mailing/Form/Schedule.php | 11 ++++------- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/CRM/Mailing/Form/Approve.php b/CRM/Mailing/Form/Approve.php index 664bcb2a9f..959531100b 100644 --- a/CRM/Mailing/Form/Approve.php +++ b/CRM/Mailing/Form/Approve.php @@ -196,6 +196,13 @@ class CRM_Mailing_Form_Approve extends CRM_Core_Form { $job->mailing_id = $ids['mailing_id']; $job->delete(); } + else { + $mailing = new CRM_Mailing_BAO_Mailing(); + $mailing->id = $ids['mailing_id']; + $mailing->find(TRUE); + + $params['scheduled_date'] = CRM_Utils_Date::processDate($mailing->scheduled_date); + } CRM_Mailing_BAO_Mailing::create($params, $ids); diff --git a/CRM/Mailing/Form/Schedule.php b/CRM/Mailing/Form/Schedule.php index 35987319f6..33617775e2 100644 --- a/CRM/Mailing/Form/Schedule.php +++ b/CRM/Mailing/Form/Schedule.php @@ -294,18 +294,15 @@ class CRM_Mailing_Form_Schedule extends CRM_Core_Form { } else { // reset them in case this mailing was rejected + $mailing = new CRM_Mailing_BAO_Mailing(); + $mailing->id = $ids['mailing_id']; + $mailing->find(TRUE); + $mailing->approver_id = 'null'; $mailing->approval_date = 'null'; $mailing->approval_status_id = 'null'; } - if ($params['now']) { - $params['scheduled_date'] = date('YmdHis'); - } - else { - $params['scheduled_date'] = CRM_Utils_Date::processDate($params['start_date'] . ' ' . $params['start_date_time']); - } - /* Build the mailing object */ CRM_Mailing_BAO_Mailing::create($params, $ids); -- 2.25.1