Fix up cleaning out array of from emails and avoid execption as found by Jitendra
authorSeamus Lee <seamuslee001@gmail.com>
Mon, 1 Aug 2016 11:30:30 +0000 (21:30 +1000)
committerSeamus Lee <seamuslee001@gmail.com>
Mon, 1 Aug 2016 11:40:16 +0000 (21:40 +1000)
CRM/Contact/Form/Task/EmailCommon.php

index e52e3bfc9b412d47be78b2d5f4b9e2edb11a6430..be19562a850ca01fc6f93707f105676bdeb3ae92 100644 (file)
@@ -129,12 +129,8 @@ class CRM_Contact_Form_Task_EmailCommon {
       $form->_emails[$domainEmail] = $domainEmail;
     }
     $form->_fromEmails = CRM_Utils_Array::crmArrayMerge($emails, $domainEmails);
-    foreach ($form->_fromEmails as $key => $fromEmail) {
-      if (empty($fromEmail)) {
-        unset($form->_fromEmails[$key]);
-      }
-    }
-    if (!empty($emails)) {
+    $form->_fromEmails = array_filter($form->_fromEmails);
+    if (is_numeric(key($form->_fromEmails))) {
       // Add signature
       $defaultEmail = civicrm_api3('email', 'getsingle', array('id' => key($form->_fromEmails)));
       $defaults = array();