From 5342ce37fd81396294ab409c34a56444474a07ae Mon Sep 17 00:00:00 2001 From: Eileen McNaughton Date: Tue, 8 Feb 2022 17:35:48 +1300 Subject: [PATCH] Format money in custom fields once, on the tpl layer This ensures the raw value is available to the template layer and uses it rather than the formatted value for money display. It rather feels it would be better to separate out this view use case in case there are others hidden in there - but I think this tpl is only used with this assign --- CRM/Core/BAO/CustomGroup.php | 1 + templates/CRM/Custom/Page/CustomDataView.tpl | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CRM/Core/BAO/CustomGroup.php b/CRM/Core/BAO/CustomGroup.php index 7a8ca08a4e..c634712e33 100644 --- a/CRM/Core/BAO/CustomGroup.php +++ b/CRM/Core/BAO/CustomGroup.php @@ -1918,6 +1918,7 @@ SELECT IF( EXISTS(SELECT name FROM civicrm_contact_type WHERE name like %1), 1, 'field_data_type' => $properties['data_type'] ?? NULL, 'field_value' => CRM_Core_BAO_CustomField::displayValue($values['data'], $properties['id'], $entityId), 'options_per_line' => $properties['options_per_line'] ?? NULL, + 'data' => $values['data'], ]; // editable = whether this set contains any non-read-only fields if (!isset($details[$groupID][$values['id']]['editable'])) { diff --git a/templates/CRM/Custom/Page/CustomDataView.tpl b/templates/CRM/Custom/Page/CustomDataView.tpl index cd6360d8a4..ef2cf82c55 100644 --- a/templates/CRM/Custom/Page/CustomDataView.tpl +++ b/templates/CRM/Custom/Page/CustomDataView.tpl @@ -63,7 +63,7 @@ {$element.field_title} {if $element.field_data_type == 'Money'} {if $element.field_type == 'Text'} - {$element.field_value|crmMoney} + {$element.data|crmMoney} {else} {$element.field_value} {/if} -- 2.25.1