Deprecate some deprecated address functions: defaultCurrencySymbol
authorMatthew Wire (MJW Consulting) <mjw@mjwconsult.co.uk>
Tue, 18 Jun 2019 09:54:24 +0000 (10:54 +0100)
committereileen <emcnaughton@wikimedia.org>
Mon, 1 Jul 2019 05:35:36 +0000 (17:35 +1200)
CRM/Admin/Form/Preferences/Contribute.php
CRM/Batch/Form/Entry.php
CRM/Contribute/BAO/Widget.php
CRM/Core/BAO/Country.php
CRM/Core/Config.php
CRM/Core/Page.php
CRM/Event/Form/ParticipantFeeSelection.php
CRM/Member/Form/Membership.php
CRM/Utils/OpenFlashChart.php
templates/CRM/Batch/Form/Entry.tpl
templates/CRM/common/jsortable.tpl

index 7421754c72290db0cd7c2ef5d756b13e8edfa163..2367796184c7ed85ddb12bba202aa077344e9ddf 100644 (file)
@@ -117,14 +117,14 @@ class CRM_Admin_Form_Preferences_Contribute extends CRM_Admin_Form_Preferences {
         '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]'),
         ],
       ],
     ];
index 4d0671fa8e349200eeca6943dedab5e811adb405..b93921e07c17a494080d31d87fa39bc135f8cb58 100644 (file)
@@ -122,6 +122,7 @@ class CRM_Batch_Form_Entry extends CRM_Core_Form {
       ->addSetting(['setting' => ['monetaryThousandSeparator' => CRM_Core_Config::singleton()->monetaryThousandSeparator]])
       ->addSetting(['setting' => ['monetaryDecimalPoint' => CRM_Core_Config::singleton()->monetaryDecimalPoint]]);
 
+    $this->assign('defaultCurrencySymbol', CRM_Core_BAO_Country::defaultCurrencySymbol());
   }
 
   /**
index e4bff0b4ffec2548eb01f5e4f8ef87666d900e8b..396fae527388269a767623529ffad3fbb07fefdc 100644 (file)
@@ -49,7 +49,7 @@ class CRM_Contribute_BAO_Widget extends CRM_Contribute_DAO_Widget {
     $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
index df195660c0082b711505e8afc5cb543a25e66729..f6059a6debcef80390753e816ba2de557e3c0d9d 100644 (file)
@@ -160,8 +160,7 @@ class CRM_Core_BAO_Country extends CRM_Core_DAO_Country {
    * @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'));
   }
 
 }
index b9c632feb6d213eebb5052e0675c609507d4d42c..4e3679fb6d4d305d38afedff0d4e7261fda28ada 100644 (file)
@@ -496,6 +496,7 @@ class CRM_Core_Config extends CRM_Core_Config_MagicMerge {
    * @return string
    */
   public function defaultCurrencySymbol($defaultCurrency = NULL) {
+    CRM_Core_Error::deprecatedFunctionWarning('CRM_Core_BAO_Country::defaultCurrencySymbol');
     return CRM_Core_BAO_Country::defaultCurrencySymbol($defaultCurrency);
   }
 
index 145c91af53352081c761e203fa89511e411f4e26..b19388283fc8d073aea22b09bf970108467c3857 100644 (file)
@@ -214,6 +214,10 @@ class CRM_Core_Page {
 
     $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();
 
index ee1827f388815e4dea8dfa29d0859a363c6d9963..d79cc636e17da6f121a06ce7666f69fffd75b8ef 100644 (file)
@@ -159,8 +159,7 @@ class CRM_Event_Form_ParticipantFeeSelection extends CRM_Core_Form {
     $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 = [];
index ec39152a44185b6bf86f0260299ab2fdba97cbab..cf5bf72ffce9e0d781c022f39d5d4fc489c801d6 100644 (file)
@@ -418,7 +418,7 @@ class CRM_Member_Form_Membership extends CRM_Member_Form {
   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;
index 26e34292ebfcbab0f338e35dd5c76278ff1457fa..178f093bb0b7e832469004dc387aca9faacce11d 100644 (file)
@@ -98,8 +98,7 @@ class CRM_Utils_OpenFlashChart {
     $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 @@ class CRM_Utils_OpenFlashChart {
     $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 @@ class CRM_Utils_OpenFlashChart {
     }
 
     // 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#");
index 6233b3f9885b087e92637327f471b3c4eb622870..994f2448022d39ef1965ac99b3bdfd522ff44c82 100644 (file)
@@ -54,7 +54,7 @@
       <td class="label">
         <label>{ts}Total amount entered{/ts}</label>
       </td>
-      <td class="right">{$config->defaultCurrencySymbol} <span class="batch-actual-total"></span></td>
+      <td class="right">{$defaultCurrencySymbol} <span class="batch-actual-total"></span></td>
     </tr>
   </table>
 
index 7beb21dae90e2a51ccb4728ce42f647610a6c015..a83957e16def220177e2cb29f1e2a9d24fc241cc 100644 (file)
 
   //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 );
   };
 
   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 );