Skip to content

Commit

Permalink
Fix for dev/core#2446: issue with custom money fields and drop downs.
Browse files Browse the repository at this point in the history
  • Loading branch information
jaapjansma authored and eileenmcnaughton committed Mar 16, 2021
1 parent 2fb87bd commit 44b431f
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion CRM/Core/BAO/CustomField.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
Expand Down Expand Up @@ -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}'";
}
Expand Down

0 comments on commit 44b431f

Please sign in to comment.