From 18ec726bc8d5a844972557c82de58d31c0ffd9cb Mon Sep 17 00:00:00 2001 From: Coleman Watts Date: Thu, 30 Oct 2014 14:57:32 -0400 Subject: [PATCH] Api getfields code cleanup --- api/v3/utils.php | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/api/v3/utils.php b/api/v3/utils.php index aec042463e..b1ae45a5da 100644 --- a/api/v3/utils.php +++ b/api/v3/utils.php @@ -1637,23 +1637,18 @@ function _civicrm_api_get_fields($entity, $unique = FALSE, &$params = array()) { * fields are prefixed with 'custom_' to represent api params */ function _civicrm_api_get_custom_fields($entity, &$params) { - $customfields = array(); $entity = _civicrm_api_get_camel_name($entity); - if (strtolower($entity) == 'contact') { - // Use sub-type if available, otherwise stick with 'Contact' + if ($entity == 'Contact') { + // Use sub-type if available, otherwise "NULL" to fetch from all contact types $entity = CRM_Utils_Array::value('contact_type', $params); } - $retrieveOnlyParent = FALSE; - // we could / should probably test for other subtypes here - e.g. activity_type_id - if($entity == 'Contact'){ - empty($params['contact_sub_type']); - } $customfields = CRM_Core_BAO_CustomField::getFields($entity, FALSE, FALSE, + // we could / should probably test for other subtypes here - e.g. activity_type_id CRM_Utils_Array::value('contact_sub_type', $params), NULL, - $retrieveOnlyParent, + FALSE, FALSE, FALSE ); -- 2.25.1