CRM-12759 fix inconsistency in application of multisite setting
authoreileen <eileen@fuzion.co.nz>
Tue, 4 Jun 2013 00:58:35 +0000 (12:58 +1200)
committereileen <eileen@fuzion.co.nz>
Tue, 4 Jun 2013 01:11:25 +0000 (13:11 +1200)
CRM/Contact/BAO/Contact.php

index a578df67b43f69d9cf9c8333dde8d407a7bfda5f..4742ec1cdea19fefda7075ea4a5f8ce854edb265 100644 (file)
@@ -324,16 +324,15 @@ class CRM_Contact_BAO_Contact extends CRM_Contact_DAO_Contact {
       if (CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::MULTISITE_PREFERENCES_NAME,
         'is_enabled'
       )) {
-        // in order to make sure that every contact must be added to a group (CRM-4613) -
+        // Enabling multisite causes the contact to be added to the domain group
         $domainGroupID = CRM_Core_BAO_Domain::getGroupId();
-        if (CRM_Utils_Array::value('group', $params) && is_array($params['group'])) {
-          $grpFlp = array_flip($params['group']);
-          if (!array_key_exists(1, $grpFlp)) {
+        if(!empty($domainGroupID)){
+          if (CRM_Utils_Array::value('group', $params) && is_array($params['group'])) {
             $params['group'][$domainGroupID] = 1;
           }
-        }
-        else {
-          $params['group'] = array($domainGroupID => 1);
+          else {
+            $params['group'] = array($domainGroupID => 1);
+          }
         }
       }