From c02ce9de57b41149d25768a2b960be8118509574 Mon Sep 17 00:00:00 2001 From: eileen Date: Mon, 1 Mar 2021 09:22:33 +1300 Subject: [PATCH] [REF] clean up if This just makes 2 lines simpler. The issue is that if checks the same thing twice - presumably the if empty check got added for the e-notice but the other was not removed --- CRM/Core/Form/Task/PDFLetterCommon.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/CRM/Core/Form/Task/PDFLetterCommon.php b/CRM/Core/Form/Task/PDFLetterCommon.php index 330e68c0c1..03dadff66e 100644 --- a/CRM/Core/Form/Task/PDFLetterCommon.php +++ b/CRM/Core/Form/Task/PDFLetterCommon.php @@ -37,6 +37,7 @@ class CRM_Core_Form_Task_PDFLetterCommon { * Build the form object. * * @var CRM_Core_Form $form + * @throws \CRM_Core_Exception */ public static function buildQuickForm(&$form) { // This form outputs a file so should never be submitted via ajax @@ -222,6 +223,7 @@ class CRM_Core_Form_Task_PDFLetterCommon { * * @return string $html_message * + * @throws \CRM_Core_Exception * @throws \CiviCRM_API3_Exception * @throws \Civi\API\Exception\UnauthorizedException */ @@ -241,12 +243,12 @@ class CRM_Core_Form_Task_PDFLetterCommon { if (!empty($formValues['bind_format']) && $formValues['format_id']) { $messageTemplate['pdf_format_id'] = $formValues['format_id']; } - if (!empty($formValues['saveTemplate']) && $formValues['saveTemplate']) { + if (!empty($formValues['saveTemplate'])) { $messageTemplate['msg_title'] = $formValues['saveTemplateName']; CRM_Core_BAO_MessageTemplate::add($messageTemplate); } - if (!empty($formValues['updateTemplate']) && $formValues['template'] && $formValues['updateTemplate']) { + if ($formValues['template'] && !empty($formValues['updateTemplate'])) { $messageTemplate['id'] = $formValues['template']; unset($messageTemplate['msg_title']); @@ -264,13 +266,13 @@ class CRM_Core_Form_Task_PDFLetterCommon { $documentInfo = CRM_Core_BAO_File::getEntityFile('civicrm_msg_template', $formValues['template']); foreach ((array) $documentInfo as $info) { - list($html_message, $formValues['document_type']) = CRM_Utils_PDF_Document::docReader($info['fullPath'], $info['mime_type']); + [$html_message, $formValues['document_type']] = CRM_Utils_PDF_Document::docReader($info['fullPath'], $info['mime_type']); $formValues['document_file_path'] = $info['fullPath']; } } // extract the content of uploaded document file elseif (!empty($formValues['document_file'])) { - list($html_message, $formValues['document_type']) = CRM_Utils_PDF_Document::docReader($formValues['document_file']['name'], $formValues['document_file']['type']); + [$html_message, $formValues['document_type']] = CRM_Utils_PDF_Document::docReader($formValues['document_file']['name'], $formValues['document_file']['type']); $formValues['document_file_path'] = $formValues['document_file']['name']; } -- 2.25.1