From: yashodha Date: Wed, 20 Jul 2016 09:04:47 +0000 (+0530) Subject: CRM-18591: group_type parameter ignored when using API to create group X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=af3e0975790966a7d9d2402cd2222f77eb43c53c;p=civicrm-core.git CRM-18591: group_type parameter ignored when using API to create group ---------------------------------------- * CRM-18591: group_type parameter ignored when using API to create group https://issues.civicrm.org/jira/browse/CRM-18591 --- diff --git a/CRM/Contact/BAO/Group.php b/CRM/Contact/BAO/Group.php index 743ab94ccd..58a68060ef 100644 --- a/CRM/Contact/BAO/Group.php +++ b/CRM/Contact/BAO/Group.php @@ -365,7 +365,7 @@ class CRM_Contact_BAO_Group extends CRM_Contact_DAO_Group { if (isset($params['group_type'])) { if (is_array($params['group_type'])) { $params['group_type'] = CRM_Core_DAO::VALUE_SEPARATOR . implode(CRM_Core_DAO::VALUE_SEPARATOR, - array_keys($params['group_type']) + $params['group_type'] ) . CRM_Core_DAO::VALUE_SEPARATOR; } } diff --git a/CRM/Group/Form/Edit.php b/CRM/Group/Form/Edit.php index ab615f9958..1f09110cf5 100644 --- a/CRM/Group/Form/Edit.php +++ b/CRM/Group/Form/Edit.php @@ -384,7 +384,17 @@ WHERE title = %1 } $params['is_reserved'] = CRM_Utils_Array::value('is_reserved', $params, FALSE); - $params['group_type'] = CRM_Utils_Array::value('group_type', $params, array()); + + $groupTypeIds = array(); + $groupType = CRM_Utils_Array::value('group_type', $params); + if (is_array($groupType)) { + foreach ($groupType as $type => $selected) { + if ($selected) { + $groupTypeIds[] = $type; + } + } + } + $params['group_type'] = $groupTypeIds; $customFields = CRM_Core_BAO_CustomField::getFields('Group'); $params['custom'] = CRM_Core_BAO_CustomField::postProcess($params, diff --git a/xml/schema/Contact/Group.xml b/xml/schema/Contact/Group.xml index 5f09e4147e..fb9c1bd671 100644 --- a/xml/schema/Contact/Group.xml +++ b/xml/schema/Contact/Group.xml @@ -119,6 +119,9 @@ Group Type 128 FK to group type + + group_type + 1.9