diff --git a/CRM/Admin/Form/Preferences/Contribute.php b/CRM/Admin/Form/Preferences/Contribute.php index 7421754c7229..2367796184c7 100644 --- a/CRM/Admin/Form/Preferences/Contribute.php +++ b/CRM/Admin/Form/Preferences/Contribute.php @@ -117,14 +117,14 @@ public function buildQuickForm() { 'weight' => 8, 'option_values' => [ 'Do_not_show' => ts('Do not show breakdown, only show total -i.e ' . - $config->defaultCurrencySymbol . '120.00'), + CRM_Core_BAO_Country::defaultCurrencySymbol() . '120.00'), 'Inclusive' => ts('Show [tax term] inclusive price - i.e. ' . - $config->defaultCurrencySymbol . + CRM_Core_BAO_Country::defaultCurrencySymbol() . '120.00 (includes [tax term] of ' . - $config->defaultCurrencySymbol . '20.00)'), + CRM_Core_BAO_Country::defaultCurrencySymbol() . '20.00)'), 'Exclusive' => ts('Show [tax term] exclusive price - i.e. ' . - $config->defaultCurrencySymbol . '100.00 + ' . - $config->defaultCurrencySymbol . '20.00 [tax term]'), + CRM_Core_BAO_Country::defaultCurrencySymbol() . '100.00 + ' . + CRM_Core_BAO_Country::defaultCurrencySymbol() . '20.00 [tax term]'), ], ], ]; diff --git a/CRM/Batch/Form/Entry.php b/CRM/Batch/Form/Entry.php index 4d0671fa8e34..b93921e07c17 100644 --- a/CRM/Batch/Form/Entry.php +++ b/CRM/Batch/Form/Entry.php @@ -122,6 +122,7 @@ public function preProcess() { ->addSetting(['setting' => ['monetaryThousandSeparator' => CRM_Core_Config::singleton()->monetaryThousandSeparator]]) ->addSetting(['setting' => ['monetaryDecimalPoint' => CRM_Core_Config::singleton()->monetaryDecimalPoint]]); + $this->assign('defaultCurrencySymbol', CRM_Core_BAO_Country::defaultCurrencySymbol()); } /** diff --git a/CRM/Contribute/BAO/Widget.php b/CRM/Contribute/BAO/Widget.php index e4bff0b4ffec..396fae527388 100644 --- a/CRM/Contribute/BAO/Widget.php +++ b/CRM/Contribute/BAO/Widget.php @@ -49,7 +49,7 @@ public static function getContributionPageData($contributionPageID, $widgetID, $ $config = CRM_Core_Config::singleton(); $data = []; - $data['currencySymbol'] = $config->defaultCurrencySymbol; + $data['currencySymbol'] = CRM_Core_BAO_Country::defaultCurrencySymbol(); if (empty($contributionPageID) || CRM_Utils_Type::validate($contributionPageID, 'Integer') == NULL diff --git a/CRM/Core/BAO/Country.php b/CRM/Core/BAO/Country.php index df195660c008..f6059a6debce 100644 --- a/CRM/Core/BAO/Country.php +++ b/CRM/Core/BAO/Country.php @@ -160,8 +160,7 @@ public static function defaultCurrencySymbol($defaultCurrency = NULL) { * @return string */ public static function getDefaultCurrencySymbol($k = NULL) { - $config = CRM_Core_Config::singleton(); - return $config->defaultCurrencySymbol(Civi::settings()->get('defaultCurrency')); + return CRM_Core_BAO_Country::defaultCurrencySymbol(\Civi::settings()->get('defaultCurrency')); } } diff --git a/CRM/Core/Config.php b/CRM/Core/Config.php index b9c632feb6d2..4e3679fb6d4d 100644 --- a/CRM/Core/Config.php +++ b/CRM/Core/Config.php @@ -496,6 +496,7 @@ public function defaultContactCountryName() { * @return string */ public function defaultCurrencySymbol($defaultCurrency = NULL) { + CRM_Core_Error::deprecatedFunctionWarning('CRM_Core_BAO_Country::defaultCurrencySymbol'); return CRM_Core_BAO_Country::defaultCurrencySymbol($defaultCurrency); } diff --git a/CRM/Core/Page.php b/CRM/Core/Page.php index 145c91af5335..b19388283fc8 100644 --- a/CRM/Core/Page.php +++ b/CRM/Core/Page.php @@ -214,6 +214,10 @@ public function run() { $config = CRM_Core_Config::singleton(); + // @fixme this is probably the wrong place for this. It is required by jsortable.tpl which is inherited from many page templates. + // So we have to add it here to deprecate $config->defaultCurrencySymbol + $this->assign('defaultCurrencySymbol', CRM_Core_BAO_Country::defaultCurrencySymbol()); + // Intermittent alert to admins CRM_Utils_Check::singleton()->showPeriodicAlerts(); diff --git a/CRM/Event/Form/ParticipantFeeSelection.php b/CRM/Event/Form/ParticipantFeeSelection.php index ee1827f38881..d79cc636e17d 100644 --- a/CRM/Event/Form/ParticipantFeeSelection.php +++ b/CRM/Event/Form/ParticipantFeeSelection.php @@ -159,8 +159,7 @@ public function buildQuickForm() { $this->assign('pendingRefund', array_search('Pending refund', $statuses)); $this->assign('participantStatus', $this->_participantStatus); - $config = CRM_Core_Config::singleton(); - $this->assign('currencySymbol', $config->defaultCurrencySymbol); + $this->assign('currencySymbol', CRM_Core_BAO_Country::defaultCurrencySymbol()); // line items block $lineItem = $event = []; diff --git a/CRM/Member/Form/Membership.php b/CRM/Member/Form/Membership.php index ec39152a4418..cf5bf72ffce9 100644 --- a/CRM/Member/Form/Membership.php +++ b/CRM/Member/Form/Membership.php @@ -418,7 +418,7 @@ public function setDefaultValues() { public function buildQuickForm() { $this->buildQuickEntityForm(); - $this->assign('currency', CRM_Core_Config::singleton()->defaultCurrencySymbol); + $this->assign('currency', CRM_Core_BAO_Country::defaultCurrencySymbol()); $isUpdateToExistingRecurringMembership = $this->isUpdateToExistingRecurringMembership(); // build price set form. $buildPriceSet = FALSE; diff --git a/CRM/Utils/OpenFlashChart.php b/CRM/Utils/OpenFlashChart.php index 26e34292ebfc..178f093bb0b7 100644 --- a/CRM/Utils/OpenFlashChart.php +++ b/CRM/Utils/OpenFlashChart.php @@ -98,8 +98,7 @@ public static function &barChart(&$params) { $ySteps = $yMax / 5; $bars = []; - $config = CRM_Core_Config::singleton(); - $symbol = $config->defaultCurrencySymbol; + $symbol = CRM_Core_BAO_Country::defaultCurrencySymbol(); foreach ($values as $barCount => $barVal) { $bars[$barCount] = new bar_glass(); @@ -214,8 +213,7 @@ public static function &pieChart(&$params) { $graphTitle = !empty($params['legend']) ? $params['legend'] : ts('Pie Chart'); // get the currency. - $config = CRM_Core_Config::singleton(); - $symbol = $config->defaultCurrencySymbol; + $symbol = CRM_Core_BAO_Country::defaultCurrencySymbol(); $pie = new pie(); $pie->radius(100); @@ -296,8 +294,7 @@ public static function &bar_3dChart(&$params) { } // get the currency. - $config = CRM_Core_Config::singleton(); - $symbol = $config->defaultCurrencySymbol; + $symbol = CRM_Core_BAO_Country::defaultCurrencySymbol(); // set the tooltip. $tooltip = CRM_Utils_Array::value('tip', $params, "$symbol #val#"); diff --git a/templates/CRM/Batch/Form/Entry.tpl b/templates/CRM/Batch/Form/Entry.tpl index 6233b3f9885b..994f2448022d 100644 --- a/templates/CRM/Batch/Form/Entry.tpl +++ b/templates/CRM/Batch/Form/Entry.tpl @@ -54,7 +54,7 @@ - {$config->defaultCurrencySymbol} + {$defaultCurrencySymbol} diff --git a/templates/CRM/common/jsortable.tpl b/templates/CRM/common/jsortable.tpl index 7beb21dae90e..a83957e16def 100644 --- a/templates/CRM/common/jsortable.tpl +++ b/templates/CRM/common/jsortable.tpl @@ -167,7 +167,7 @@ //plugin to sort on currency cj.fn.dataTableExt.oSort['currency-asc'] = function(a,b) { - var symbol = "{/literal}{$config->defaultCurrencySymbol()}{literal}"; + var symbol = "{/literal}{$defaultCurrencySymbol}{literal}"; var x = (a == "-") ? 0 : a.replace( symbol, "" ); var y = (b == "-") ? 0 : b.replace( symbol, "" ); x = parseFloat( x ); @@ -176,7 +176,7 @@ }; cj.fn.dataTableExt.oSort['currency-desc'] = function(a,b) { - var symbol = "{/literal}{$config->defaultCurrencySymbol()}{literal}"; + var symbol = "{/literal}{$defaultCurrencySymbol}{literal}"; var x = (a == "-") ? 0 : a.replace( symbol, "" ); var y = (b == "-") ? 0 : b.replace( symbol, "" ); x = parseFloat( x );