X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=api%2Fv3%2Futils.php;h=bfa476adc4ec2d887bd8d90b6903f195b7be7c9c;hb=7a47ff14f4553230ff12ae19337ba750a421a898;hp=814d11e0b83a9ab9ccfd5a3a066e3a3a31cf5b3b;hpb=f118320a31b52481a17dae33b46b1826fa71d0de;p=civicrm-core.git diff --git a/api/v3/utils.php b/api/v3/utils.php index 814d11e0b8..bfa476adc4 100644 --- a/api/v3/utils.php +++ b/api/v3/utils.php @@ -332,10 +332,6 @@ function _civicrm_api3_get_DAO($name) { if ($name == 'MailingRecipients') { return 'CRM_Mailing_DAO_Recipients'; } - // FIXME: DAO should be renamed CRM_Mailing_DAO_MailingComponent - if ($name == 'MailingComponent') { - return 'CRM_Mailing_DAO_Component'; - } // FIXME: DAO should be renamed CRM_ACL_DAO_AclRole if ($name == 'AclRole') { return 'CRM_ACL_DAO_EntityRole'; @@ -1977,43 +1973,15 @@ function _civicrm_api_get_custom_fields($entity, &$params) { // Regular fields have a 'name' property $value['name'] = 'custom_' . $key; $value['title'] = $value['label']; - $value['type'] = _getStandardTypeFromCustomDataType($value); + if ($value['data_type'] == 'Date' && CRM_Utils_Array::value('time_format', $value, 0) > 0) { + $value['data_type'] = 'DateTime'; + } + $value['type'] = CRM_Utils_Array::value($value['data_type'], CRM_Core_BAO_CustomField::dataToType()); $ret['custom_' . $key] = $value; } return $ret; } -/** - * Translate the custom field data_type attribute into a std 'type'. - * - * @param array $value - * - * @return int - */ -function _getStandardTypeFromCustomDataType($value) { - $dataType = $value['data_type']; - //CRM-15792 - If date custom field contains timeformat change type to DateTime - if ($value['data_type'] == 'Date' && isset($value['time_format']) && $value['time_format'] > 0) { - $dataType = 'DateTime'; - } - $mapping = array( - 'String' => CRM_Utils_Type::T_STRING, - 'Int' => CRM_Utils_Type::T_INT, - 'Money' => CRM_Utils_Type::T_MONEY, - 'Memo' => CRM_Utils_Type::T_LONGTEXT, - 'Float' => CRM_Utils_Type::T_FLOAT, - 'Date' => CRM_Utils_Type::T_DATE, - 'DateTime' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME, - 'Boolean' => CRM_Utils_Type::T_BOOLEAN, - 'StateProvince' => CRM_Utils_Type::T_INT, - 'File' => CRM_Utils_Type::T_STRING, - 'Link' => CRM_Utils_Type::T_STRING, - 'ContactReference' => CRM_Utils_Type::T_INT, - 'Country' => CRM_Utils_Type::T_INT, - ); - return $mapping[$dataType]; -} - /** * Fill params array with alternate (alias) values where a field has an alias and that is filled & the main field isn't.