Api getfields code cleanup
authorColeman Watts <coleman@civicrm.org>
Thu, 30 Oct 2014 18:57:32 +0000 (14:57 -0400)
committerColeman Watts <coleman@civicrm.org>
Thu, 30 Oct 2014 18:57:32 +0000 (14:57 -0400)
api/v3/utils.php

index aec042463e5b555e6b55054bb452f2c55b7a7da2..b1ae45a5da5e5fa8d07c087ba5e915bd8fc4cb8b 100644 (file)
@@ -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
   );