diff --git a/CRM/Contact/Form/Task/PDFTrait.php b/CRM/Contact/Form/Task/PDFTrait.php index b12d51ebc1a8..8c564649fc3d 100644 --- a/CRM/Contact/Form/Task/PDFTrait.php +++ b/CRM/Contact/Form/Task/PDFTrait.php @@ -414,7 +414,7 @@ public function processTemplate(&$formValues) { $html_message = $formValues['html_message'] ?? NULL; // process message template - if (!empty($formValues['saveTemplate']) || !empty($formValues['updateTemplate'])) { + if (!empty($this->getSubmittedValue('saveTemplate')) || !empty($formValues['updateTemplate'])) { $messageTemplate = [ 'msg_text' => NULL, 'msg_html' => $formValues['html_message'], @@ -426,8 +426,8 @@ public function processTemplate(&$formValues) { if (!empty($formValues['bind_format']) && $formValues['format_id']) { $messageTemplate['pdf_format_id'] = $formValues['format_id']; } - if (!empty($formValues['saveTemplate'])) { - $messageTemplate['msg_title'] = $formValues['saveTemplateName']; + if ($this->getSubmittedValue('saveTemplate')) { + $messageTemplate['msg_title'] = $this->getSubmittedValue('saveTemplateName'); CRM_Core_BAO_MessageTemplate::add($messageTemplate); }