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 21:34:34 +0000 (07:34 +1000)
CRM/Contact/Form/Task/EmailCommon.php

index a01b82f8f38415bd9039ec5334793b5fb499e707..48d42da9feaa2838b104058035e40c59656180f8 100644 (file)
@@ -131,12 +131,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();