Merge pull request #520 from dlobo/CRM-12274
[civicrm-core.git] / api / v3 / Group.php
index 817a783c00b84f085d28ddc9dd8548657445aff1..2dc1d426d2228371083d2a79013c3dad8030ee1d 100644 (file)
@@ -97,7 +97,7 @@ function _civicrm_api3_group_create_spec(&$params) {
  */
 function civicrm_api3_group_get($params) {
 
-  $options          = _civicrm_api3_get_options_from_params($params, TRUE, 'get');
+  $options          = _civicrm_api3_get_options_from_params($params, TRUE, 'group', 'get');
   $sort             = CRM_Utils_Array::value('sort', $options, NULL);
   $offset           = CRM_Utils_Array::value('offset', $options);
   $rowCount         = CRM_Utils_Array::value('limit', $options);
@@ -105,9 +105,13 @@ function civicrm_api3_group_get($params) {
   $inputParams      = CRM_Utils_Array::value('input_params', $options, array());
   if(is_array($returnProperties) && !empty($returnProperties)){
     // group function takes $returnProperties in non standard format & doesn't add id
+    unset($returnProperties['group_id']);
     $returnProperties['id'] = 1;
     $returnProperties = array_keys($returnProperties);
   }
+  if (CRM_Utils_Array::value('group_id', $inputParams)) {
+    $inputParams['id'] = $inputParams['group_id'];
+  }
   $groupObjects = CRM_Contact_BAO_Group::getGroups($inputParams, $returnProperties, $sort, $offset, $rowCount);
   if (empty($groupObjects)) {
     return civicrm_api3_create_success(FALSE);