From 9c32b8f6c447e655d105060716ec263e267b4336 Mon Sep 17 00:00:00 2001 From: Coleman Watts Date: Tue, 24 Feb 2015 17:03:40 -0500 Subject: [PATCH] Correctly represent getstat action in api explorer and metadata --- api/v3/Generic.php | 1 + templates/CRM/Admin/Page/APIExplorer.js | 8 ++++---- templates/CRM/Admin/Page/APIExplorer.tpl | 2 +- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/api/v3/Generic.php b/api/v3/Generic.php index 7344f1b2d1..cef725e085 100644 --- a/api/v3/Generic.php +++ b/api/v3/Generic.php @@ -99,6 +99,7 @@ function civicrm_api3_generic_getfields($apiRequest) { case 'get': case 'getsingle': case 'getcount': + case 'getstat': $metadata = _civicrm_api_get_fields($apiRequest['entity'], $unique, $apiRequest['params']); if (empty($metadata['id'])) { // if id is not set we will set it eg. 'id' from 'case_id', case_id will be an alias diff --git a/templates/CRM/Admin/Page/APIExplorer.js b/templates/CRM/Admin/Page/APIExplorer.js index 14fcfe0e4b..bc829e5d4d 100644 --- a/templates/CRM/Admin/Page/APIExplorer.js +++ b/templates/CRM/Admin/Page/APIExplorer.js @@ -131,8 +131,8 @@ CRM.alert(data.deprecated, entity + ' Deprecated'); } showFields(required); - if (action === 'get' || action === 'getsingle') { - showReturn(); + if (action === 'get' || action === 'getsingle' || action === 'getstat') { + showReturn(action === 'getstat' ? ts('Group by') : ts('Fields to return')); } }); } @@ -140,8 +140,8 @@ /** * For "get" actions show the "return" options */ - function showReturn() { - $('#api-params').prepend($(returnTpl({}))); + function showReturn(title) { + $('#api-params').prepend($(returnTpl({title: title}))); $('#api-return-value').crmSelect2({data: fields, multiple: true}); } diff --git a/templates/CRM/Admin/Page/APIExplorer.tpl b/templates/CRM/Admin/Page/APIExplorer.tpl index e4f92c8a1f..3a8202f800 100644 --- a/templates/CRM/Admin/Page/APIExplorer.tpl +++ b/templates/CRM/Admin/Page/APIExplorer.tpl @@ -260,7 +260,7 @@