CRM-21469: Fix removal from all groups from Edit Contact.
authorMathieu Lutfy <mathieu@bidon.ca>
Wed, 22 Nov 2017 17:24:16 +0000 (12:24 -0500)
committerMathieu Lutfy <mathieu@bidon.ca>
Wed, 22 Nov 2017 17:24:16 +0000 (12:24 -0500)
CRM/Contact/Form/Contact.php

index 2a14de16e94e5af8ec29dd53aa67c8f10b7b2e92..e65b49d2d6be84a8806452cfaeca370a3ca8176e 100644 (file)
@@ -943,11 +943,10 @@ class CRM_Contact_Form_Contact extends CRM_Core_Form {
     // process shared contact address.
     CRM_Contact_BAO_Contact_Utils::processSharedAddress($params['address']);
 
-    if (!array_key_exists('TagsAndGroups', $this->_editOptions) && !empty($params['group'])) {
+    if (!array_key_exists('TagsAndGroups', $this->_editOptions)) {
       unset($params['group']);
     }
-
-    if (!empty($params['contact_id']) && ($this->_action & CRM_Core_Action::UPDATE) && !empty($params['group'])) {
+    elseif (!empty($params['contact_id']) && ($this->_action & CRM_Core_Action::UPDATE)) {
       // figure out which all groups are intended to be removed
       $contactGroupList = CRM_Contact_BAO_GroupContact::getContactGroup($params['contact_id'], 'Added');
       if (is_array($contactGroupList)) {