Merge pull request #2565 from deepak-srivastava/CRM-12467-soft-credit-search
[civicrm-core.git] / CRM / Core / BAO / Email.php
index d3cb38f4b78771b199f05b938acaac335477956d..5d6776938638bf3b337dac64bb12b60e9b22267a 100644 (file)
@@ -1,7 +1,7 @@
 <?php
 /*
  +--------------------------------------------------------------------+
- | CiviCRM version 4.3                                                |
+ | CiviCRM version 4.4                                                |
  +--------------------------------------------------------------------+
  | Copyright CiviCRM LLC (c) 2004-2013                                |
  +--------------------------------------------------------------------+
@@ -287,10 +287,12 @@ AND    reset_date IS NULL
     $contactID       = $session->get('userID');
     $fromEmailValues = array();
 
-    // add the domain email id
-    $domainEmail = CRM_Core_BAO_Domain::getNameAndEmail();
-    $domainEmail = "$domainEmail[0] <$domainEmail[1]>";
-    $fromEmailValues[$domainEmail] = htmlspecialchars($domainEmail);
+    // add all configured FROM email addresses
+    $domainFrom = CRM_Core_OptionGroup::values('from_email_address');
+    foreach (array_keys($domainFrom) as $k) {
+      $domainEmail = $domainFrom[$k];
+      $fromEmailValues[$domainEmail] = htmlspecialchars($domainEmail);
+    }
 
     // add logged in user's active email ids
     if ($contactID) {
@@ -305,7 +307,7 @@ AND    reset_date IS NULL
         $fromEmail = "$fromDisplayName <$email>";
         $fromEmailHtml = htmlspecialchars($fromEmail) . ' ' . $emailVal['locationType'];
 
-        if (CRM_Utils_Array::value('is_primary', $emailVal)) {
+        if (!empty($emailVal['is_primary'])) {
           $fromEmailHtml .= ' ' . ts('(preferred)');
         }
         $fromEmailValues[$fromEmail] = $fromEmailHtml;