diff --git a/CRM/Contact/Form/Task/Email.php b/CRM/Contact/Form/Task/Email.php index 1b702c3e5ffe..4d48e2aa6965 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 @@ public function preProcess() { 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 e970aed4ef3a..7742403b9273 100644 --- a/CRM/Contact/Form/Task/EmailCommon.php +++ b/CRM/Contact/Form/Task/EmailCommon.php @@ -48,13 +48,9 @@ public static function domainEmails() { * @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 = [];