X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=api%2Fapi.php;h=8b55d97347e26335c6a7e5a35d93db3ac4556a8d;hb=867047cd42eb9ea5f73ddf4abc0b80a4f558c127;hp=6c263513e871deca72176ac02f4b600bda8b387c;hpb=1e66775e6f88ac33d643ca2d68577ab01dd41dd5;p=civicrm-core.git diff --git a/api/api.php b/api/api.php index 6c263513e8..8b55d97347 100644 --- a/api/api.php +++ b/api/api.php @@ -1,14 +1,9 @@ $apiRequest['action']); $entity = $apiRequest['entity']; - if ($entity == 'profile' && array_key_exists('profile_id', $apiRequest['params'])) { + if ($entity == 'Profile' && array_key_exists('profile_id', $apiRequest['params'])) { $getFieldsParams['profile_id'] = $apiRequest['params']['profile_id']; } $fields = civicrm_api3($entity, 'getfields', $getFieldsParams); @@ -110,14 +105,14 @@ function civicrm_error($result) { } /** - * Get camel case version of entity or action name. + * Get camel case version of entity name. * - * @param $entity + * @param string|null $entity * - * @return string + * @return string|null */ function _civicrm_api_get_camel_name($entity) { - return CRM_Utils_String::convertStringToCamel($entity); + return is_string($entity) ? CRM_Utils_String::convertStringToCamel($entity) : NULL; } /** @@ -163,6 +158,10 @@ function _civicrm_api_replace_variables(&$params, &$parentResult, $separator = ' $count = count($stringParts); } } + // CRM-16168 If we have failed to swap it out we should unset it rather than leave the placeholder. + if (substr($params[$field], 0, 6) == '$value') { + $params[$field] = NULL; + } } } } @@ -176,11 +175,9 @@ function _civicrm_api_replace_variables(&$params, &$parentResult, $separator = ' * * @return string * Entity name in underscore separated format. - * - * @fixme Why isn't this called first thing in civicrm_api wrapper? */ function _civicrm_api_get_entity_name_from_camel($entity) { - if ($entity == strtolower($entity)) { + if (!$entity || $entity === strtolower($entity)) { return $entity; } else { @@ -203,5 +200,5 @@ function _civicrm_api_get_entity_name_from_camel($entity) { */ function _civicrm_api_get_entity_name_from_dao($bao) { $daoName = str_replace("BAO", "DAO", get_class($bao)); - return _civicrm_api_get_entity_name_from_camel(CRM_Core_DAO_AllCoreTables::getBriefName($daoName)); + return CRM_Core_DAO_AllCoreTables::getBriefName($daoName); }