From 2067c79f7edcd5a4a5840e23ade049e781e30644 Mon Sep 17 00:00:00 2001 From: eileen Date: Thu, 21 May 2020 14:52:40 +1200 Subject: [PATCH] Undo variable variable. This removes the remainder of a weird variable-varible loop. No actual change --- CRM/Contact/Form/Task/EmailTrait.php | 28 +++++++++------------------- 1 file changed, 9 insertions(+), 19 deletions(-) diff --git a/CRM/Contact/Form/Task/EmailTrait.php b/CRM/Contact/Form/Task/EmailTrait.php index 2abc3f9132..8c10f84b7a 100644 --- a/CRM/Contact/Form/Task/EmailTrait.php +++ b/CRM/Contact/Form/Task/EmailTrait.php @@ -174,29 +174,19 @@ trait CRM_Contact_Form_Task_EmailTrait { $setDefaults = FALSE; } - $elements = ['to']; $this->_allContactIds = $this->_toContactIds = $this->_contactIds; - foreach ($elements as $element) { - if ($$element->getValue()) { - foreach ($this->getEmails($$element) as $value) { - $contactId = $value['contact_id']; - $email = $value['email']; - if ($contactId) { - switch ($element) { - case 'to': - $this->_contactIds[] = $this->_toContactIds[] = $contactId; - $this->_toContactEmails[] = $email; - break; - - } - - $this->_allContactIds[] = $contactId; - } + if ($to->getValue()) { + foreach ($this->getEmails($to) as $value) { + $contactId = $value['contact_id']; + $email = $value['email']; + if ($contactId) { + $this->_contactIds[] = $this->_toContactIds[] = $contactId; + $this->_toContactEmails[] = $email; + $this->_allContactIds[] = $contactId; } - - $setDefaults = TRUE; } + $setDefaults = TRUE; } //get the group of contacts as per selected by user in case of Find Activities -- 2.25.1