$allFields = array_keys($apiFields['values']);
}
$paramFields = array_keys($params);
- $undefined = array_diff($paramFields, $allFields, array_keys($_COOKIE), array('action', 'entity', 'debug', 'version', 'check_permissions', 'IDS_request_uri', 'IDS_user_agent', 'return', 'sequential', 'rowCount', 'option_offset', 'option_limit', 'custom', 'option_sort', 'options'));
+ $undefined = array_diff($paramFields, $allFields, array_keys($_COOKIE), array('action', 'entity', 'debug', 'version', 'check_permissions', 'IDS_request_uri', 'IDS_user_agent', 'return', 'sequential', 'rowCount', 'option_offset', 'option_limit', 'custom', 'option_sort', 'options', 'prettyprint'));
if ($undefined) {
$result['undefined_fields'] = array_merge($undefined);
}
}
if(!empty($params['options']['metadata'])) {
// we've made metadata an array but only supporting 'fields' atm
- if(in_array('fields', $params['options']['metadata'])) {
+ if(in_array('fields', (array) $params['options']['metadata'])) {
$fields = civicrm_api3($entity, 'getfields', array('action' => substr($action, 0, 3) == 'get' ? 'get' : 'create'));
$result['metadata']['fields'] = $fields['values'];
}
// len ('civicrm_api3_') == 13
$name = substr($name, 13, $last - 13);
}
-
+
$name = _civicrm_api_get_camel_name($name, 3);
if ($name == 'Individual' || $name == 'Household' || $name == 'Organization') {
}
}
+
$skipPermissions = !empty($params['check_permissions']) ? 0 :1;
list($entities, $options) = CRM_Contact_BAO_Query::apiQuery(
}
}
}
- // http://issues.civicrm.org/jira/browse/CRM-9150 - stick with 'simple' operators for now
- // support for other syntaxes is discussed in ticket but being put off for now
- $acceptedSQLOperators = array('=', '<=', '>=', '>', '<', 'LIKE', "<>", "!=", "NOT LIKE", 'IN', 'NOT IN', 'BETWEEN', 'NOT BETWEEN');
if (!$fields) {
$fields = array();
}
if (strtotime($params[$fieldInfo['name']]) === FALSE) {
throw new Exception($fieldInfo['name'] . " is not a valid date: " . $params[$fieldInfo['name']]);
}
- $params[$fieldInfo['name']] = CRM_Utils_Date::processDate($params[$fieldInfo['name']]);
+ $format = ($fieldInfo['type'] == CRM_Utils_Type::T_DATE) ? 'Ymd000000' : 'YmdHis';
+ $params[$fieldInfo['name']] = CRM_Utils_Date::processDate($params[$fieldInfo['name']], NULL, FALSE, $format);
}
if ((CRM_Utils_Array::value('name', $fieldInfo) != $fieldName) && !empty($params[$fieldName])) {
//If the unique field name differs from the db name & is set handle it here
FALSE,
FALSE
);
- // find out if we have any requests to resolve options
- $getoptions = CRM_Utils_Array::value('get_options', CRM_Utils_Array::value('options',$params));
- if(!is_array($getoptions)){
- $getoptions = array($getoptions);
- }
+
+ $ret = array();
foreach ($customfields as $key => $value) {
// Regular fields have a 'name' property
$value['name'] = 'custom_' . $key;
+ $value['title'] = $value['label'];
$value['type'] = _getStandardTypeFromCustomDataType($value['data_type']);
- $customfields['custom_' . $key] = $value;
- if (in_array('custom_' . $key, $getoptions)) {
- $customfields['custom_' . $key]['options'] = CRM_Core_BAO_CustomOption::valuesByID($key);
- }
- unset($customfields[$key]);
+ $ret['custom_' . $key] = $value;
}
- return $customfields;
+ return $ret;
}
/**
* Translate the custom field data_type attribute into a std 'type'