X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=api%2Fv3%2FCustomField.php;h=bb2719ba974b5475a549c2fadc6e854faa1f7ac1;hb=718e934e2c6fa496ee84f56502d73cae125b1331;hp=9fbc50ed7f2defc89b5f5cc1861d7521bedf63f1;hpb=afed0de9c0305abb1c011d6e87fd5e7a1ddee543;p=civicrm-core.git diff --git a/api/v3/CustomField.php b/api/v3/CustomField.php index 9fbc50ed7f..bb2719ba97 100644 --- a/api/v3/CustomField.php +++ b/api/v3/CustomField.php @@ -2,7 +2,7 @@ /* +--------------------------------------------------------------------+ - | CiviCRM version 4.5 | + | CiviCRM version 4.6 | +--------------------------------------------------------------------+ | Copyright CiviCRM LLC (c) 2004-2014 | +--------------------------------------------------------------------+ @@ -110,6 +110,8 @@ function _civicrm_api3_custom_field_create_spec(&$params) { * Use this API to delete an existing custom group field. * * @param $params Array id of the field to be deleted + * + * @return array * @example CustomFieldDelete.php * * {@example CustomFieldDelete.php 0} @@ -130,7 +132,10 @@ function civicrm_api3_custom_field_delete($params) { * Use this API to get existing custom fields. * * @param array $params Array to search on - *{@getfields CustomField_get} + *{* + * + * @return array +@getfields CustomField_get} * @access public * **/ @@ -138,32 +143,20 @@ function civicrm_api3_custom_field_get($params) { return _civicrm_api3_basic_get(_civicrm_api3_get_BAO(__FUNCTION__), $params); } -/* - * Helper function to validate custom field values - * - * @params Array $params Custom fields with values - * @params Array $errors Reference fields to be check with - * @params Boolean $checkForDisallowed Check for disallowed elements - * in params - * @params Boolean $checkForRequired Check for non present required elements - * in params - * @return Array Validation errors - */ - /** * Helper function to validate custom field value + * @deprecated * - * @params String $fieldName Custom field name (eg: custom_8 ) - * @params Mixed $value Field value to be validate - * @params Array $fieldDetails Field Details - * @params Array $errors Collect validation errors + * @param String $fieldName Custom field name (eg: custom_8 ) + * @param Mixed $value Field value to be validate + * @param Array $fieldDetails Field Details + * @param Array $errors Collect validation errors * - * @return Array Validation errors + * @return array Validation errors * @todo remove this function - not in use but need to review functionality before * removing as it might be useful in wrapper layer */ -function _civicrm_api3_custom_field_validate_field($fieldName, $value, $fieldDetails, &$errors = array( - )) { +function _civicrm_api3_custom_field_validate_field($fieldName, $value, $fieldDetails, &$errors = array()) { return; //see comment block if (!$value) { @@ -269,3 +262,14 @@ SELECT count(*) return $errors; } +/** + * CRM-15191 - Hack to ensure the cache gets cleared after updating a custom field + */ +function civicrm_api3_custom_field_setvalue($params) { + require_once 'api/v3/Generic/Setvalue.php'; + $result = civicrm_api3_generic_setValue(array("entity" => 'custom_field', 'params' => $params)); + if (empty($result['is_error'])) { + CRM_Utils_System::flushCache(); + } + return $result; +}