From 6f23e48aa884c0d894a9601ba96571b8c004f1a9 Mon Sep 17 00:00:00 2001 From: Jitendra Purohit Date: Mon, 22 Oct 2018 14:59:47 +0530 Subject: [PATCH] dev/core#461 - Duplicate Message template is generated when it is saved through schedule reminder form --- CRM/Admin/Form/ScheduleReminders.php | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/CRM/Admin/Form/ScheduleReminders.php b/CRM/Admin/Form/ScheduleReminders.php index 152d5ae185..2c59e0c032 100644 --- a/CRM/Admin/Form/ScheduleReminders.php +++ b/CRM/Admin/Form/ScheduleReminders.php @@ -370,10 +370,10 @@ class CRM_Admin_Form_ScheduleReminders extends CRM_Admin_Form { $errors['is_repeat'] = ts('If you are enabling repetition you must indicate the frequency and ending term.'); } - $actionSchedule = $self->parseActionSchedule($fields); - if ($actionSchedule->mapping_id) { - $mapping = CRM_Core_BAO_ActionSchedule::getMapping($actionSchedule->mapping_id); - CRM_Utils_Array::extend($errors, $mapping->validateSchedule($actionSchedule)); + $self->_actionSchedule = $self->parseActionSchedule($fields); + if ($self->_actionSchedule->mapping_id) { + $mapping = CRM_Core_BAO_ActionSchedule::getMapping($self->_actionSchedule->mapping_id); + CRM_Utils_Array::extend($errors, $mapping->validateSchedule($self->_actionSchedule)); } if (!empty($errors)) { @@ -452,7 +452,12 @@ class CRM_Admin_Form_ScheduleReminders extends CRM_Admin_Form { return; } $values = $this->controller->exportValues($this->getName()); - $bao = $this->parseActionSchedule($values)->save(); + if (empty($this->_actionSchedule)) { + $bao = $this->parseActionSchedule($values)->save(); + } + else { + $bao = $this->_actionSchedule->save(); + } // we need to set this on the form so that hooks can identify the created entity $this->set('id', $bao->id); -- 2.25.1