Merge pull request #17987 from eileenmcnaughton/pseudo_mem
[civicrm-core.git] / CRM / Contact / Form / Contact.php
index eaf910f265b65202b2d8f2463e0089c20c2430f0..04e3c8a897e79f52c58a27b38d60bf73bbe1ef31 100644 (file)
@@ -367,8 +367,8 @@ class CRM_Contact_Form_Contact extends CRM_Core_Form {
       else {
         $contactSubType = $this->_contactSubType;
         // need contact sub type to build related grouptree array during post process
-        if (!empty($_POST['contact_sub_type'])) {
-          $contactSubType = $_POST['contact_sub_type'];
+        if (!empty($_POST['qfKey'])) {
+          $contactSubType = $_POST['contact_sub_type'] ?? NULL;
         }
         //only custom data has preprocess hence directly call it
         CRM_Custom_Form_CustomData::preProcess($this, NULL, $contactSubType,
@@ -869,10 +869,11 @@ class CRM_Contact_Form_Contact extends CRM_Core_Form {
       $params['preferred_communication_method'] = 'null';
     }
 
-    $group = CRM_Utils_Array::value('group', $params);
+    $group = $params['group'] ?? NULL;
+    $params['group'] = ($params['group'] == '') ? [] : $params['group'];
     if (!empty($group)) {
       $group = is_array($group) ? $group : explode(',', $group);
-      unset($params['group']);
+      $params['group'] = [];
       foreach ($group as $key => $value) {
         $params['group'][$value] = 1;
       }