From a1b37126ebd627ce2dc423bea1a21e837c783f36 Mon Sep 17 00:00:00 2001 From: eileen Date: Fri, 27 Mar 2020 15:59:14 +1300 Subject: [PATCH] [REF] Move form specific handling back to the relevant form. The shared function has handling to set ->_single if the class is CRM_Contact_Form_Task_Email - this seems prety obviously not functionality that is shared so it should be on the CRM_Contact_Form_Task_Email class --- CRM/Contact/Form/Task/Email.php | 8 +++++++- CRM/Contact/Form/Task/EmailCommon.php | 10 +++------- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/CRM/Contact/Form/Task/Email.php b/CRM/Contact/Form/Task/Email.php index 1b702c3e5f..4d48e2aa69 100644 --- a/CRM/Contact/Form/Task/Email.php +++ b/CRM/Contact/Form/Task/Email.php @@ -76,6 +76,9 @@ class CRM_Contact_Form_Task_Email extends CRM_Contact_Form_Task { /** * Build all the data structures needed to build the form. + * + * @throws \CiviCRM_API3_Exception + * @throws \CRM_Core_Exception */ public function preProcess() { // store case id if present @@ -110,9 +113,12 @@ class CRM_Contact_Form_Task_Email extends CRM_Contact_Form_Task { else { CRM_Utils_System::setTitle(ts('New Email')); } + if ($this->_context === 'search') { + $this->_single = TRUE; + } CRM_Contact_Form_Task_EmailCommon::preProcessFromAddress($this); - if (!$cid && $this->_context != 'standalone') { + if (!$cid && $this->_context !== 'standalone') { parent::preProcess(); } diff --git a/CRM/Contact/Form/Task/EmailCommon.php b/CRM/Contact/Form/Task/EmailCommon.php index e970aed4ef..7742403b92 100644 --- a/CRM/Contact/Form/Task/EmailCommon.php +++ b/CRM/Contact/Form/Task/EmailCommon.php @@ -48,13 +48,9 @@ class CRM_Contact_Form_Task_EmailCommon { * @throws \CiviCRM_API3_Exception */ public static function preProcessFromAddress(&$form, $bounce = TRUE) { - $form->_single = FALSE; - $className = CRM_Utils_System::getClassName($form); - if (property_exists($form, '_context') && - $form->_context != 'search' && - $className == 'CRM_Contact_Form_Task_Email' - ) { - $form->_single = TRUE; + if (!isset($form->_single)) { + // @todo ensure this is already set. + $form->_single = FALSE; } $form->_emails = []; -- 2.25.1