diff --git a/CRM/Contribute/Form/Contribution/Main.php b/CRM/Contribute/Form/Contribution/Main.php index 6ff333e145f9..187c6a6941f7 100644 --- a/CRM/Contribute/Form/Contribution/Main.php +++ b/CRM/Contribute/Form/Contribution/Main.php @@ -58,6 +58,9 @@ public function preProcess() { $this->assign('isShare', CRM_Utils_Array::value('is_share', $this->_values)); $this->assign('isConfirmEnabled', CRM_Utils_Array::value('is_confirm_enabled', $this->_values)); + // Required for currency formatting in the JS layer + $this->assign('moneyFormat', CRM_Utils_Money::format(1234.56)); + $this->assign('reset', CRM_Utils_Request::retrieve('reset', 'Boolean')); $this->assign('mainDisplay', CRM_Utils_Request::retrieve('_qf_Main_display', 'Boolean', CRM_Core_DAO::$_nullObject)); diff --git a/CRM/Event/Form/Registration/Register.php b/CRM/Event/Form/Registration/Register.php index 423f635d8d58..1e78229ee87e 100644 --- a/CRM/Event/Form/Registration/Register.php +++ b/CRM/Event/Form/Registration/Register.php @@ -319,6 +319,9 @@ public function buildQuickForm() { // CRM-18399: used by template to pass pre profile id as a url arg $this->assign('custom_pre_id', $this->_values['custom_pre_id']); + // Required for currency formatting in the JS layer + $this->assign('moneyFormat', CRM_Utils_Money::format(1234.56)); + CRM_Core_Payment_ProcessorForm::buildQuickForm($this); $contactID = $this->getContactID(); diff --git a/templates/CRM/Price/Form/Calculate.tpl b/templates/CRM/Price/Form/Calculate.tpl index dab6017c0150..5241d054c702 100644 --- a/templates/CRM/Price/Form/Calculate.tpl +++ b/templates/CRM/Price/Form/Calculate.tpl @@ -31,6 +31,7 @@ var thousandMarker = '{/literal}{$config->monetaryThousandSeparator}{literal}'; var separator = '{/literal}{$config->monetaryDecimalPoint}{literal}'; var symbol = '{/literal}{$currencySymbol}{literal}'; +var moneyFormat = '{/literal}{$moneyFormat}{literal}'; var optionSep = '|'; // Recalculate the total fees based on user selection @@ -161,7 +162,7 @@ function display(totalfee) { // totalfee is monetary, round it to 2 decimal points so it can // go as a float - CRM-13491 totalfee = Math.round(totalfee*100)/100; - var totalFormattedFee = symbol + ' ' + CRM.formatMoney(totalfee, true); + var totalFormattedFee = CRM.formatMoney(totalfee, false, moneyFormat); cj('#pricevalue').html(totalFormattedFee); cj('#total_amount').val( totalfee );