CRM-21644, Fixed set default for Preferred Communication Method
authorPradeep Nayak <pradpnayak@gmail.com>
Tue, 9 Jan 2018 21:22:08 +0000 (02:52 +0530)
committerPradeep Nayak <pradpnayak@gmail.com>
Tue, 9 Jan 2018 21:22:08 +0000 (02:52 +0530)
----------------------------------------
* CRM-21644: Preferred Communication Method is not set to default for contact
  https://issues.civicrm.org/jira/browse/CRM-21644

CRM/Core/BAO/UFGroup.php

index 493ec603ec29503704ad93f632c9c62625f841e4..c2bc2bef46c6ce44ec26b55cbc145687d3edcff1 100644 (file)
@@ -2339,7 +2339,10 @@ AND    ( entity_id IS NULL OR entity_id <= 0 )
             $defaults[$name . '_custom'] = $details[$name . '_custom'];
           }
           elseif ($name == 'preferred_communication_method') {
-            $v = explode(CRM_Core_DAO::VALUE_SEPARATOR, $details[$name]);
+            $v = $details[$name];
+            if (!is_array($details[$name])) {
+              $v = explode(CRM_Core_DAO::VALUE_SEPARATOR, $v);
+            }
             foreach ($v as $item) {
               if ($item) {
                 $defaults[$fldName . "[$item]"] = 1;