From 44b431f9358ca641d51446fdec5c5f84fcfd357a Mon Sep 17 00:00:00 2001 From: Jaap Jansma Date: Mon, 15 Mar 2021 16:43:32 +0100 Subject: [PATCH] Fix for dev/core#2446: issue with custom money fields and drop downs. --- CRM/Core/BAO/CustomField.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/CRM/Core/BAO/CustomField.php b/CRM/Core/BAO/CustomField.php index f45707ca96b9..78a13a3fde6f 100644 --- a/CRM/Core/BAO/CustomField.php +++ b/CRM/Core/BAO/CustomField.php @@ -1517,7 +1517,7 @@ public static function formatCustomField( $value = 0; } - if ($customFields[$customFieldId]['data_type'] == 'Money') { + if ($customFields[$customFieldId]['data_type'] == 'Money' && $customFields[$customFieldId]['html_type'] == 'Text') { $value = CRM_Utils_Rule::cleanMoney($value); } } @@ -2701,6 +2701,9 @@ protected static function prepareCreateParams($field, $operation) { if ($field->serialize) { $params['type'] = 'varchar(255)'; } + if ($field->data_type == 'Money' && $field->html_type !== 'Text') { + $params['type'] = 'varchar(512)'; + } if (isset($field->default_value)) { $params['default'] = "'{$field->default_value}'"; }