dev/translation#65 Further remove moneyValueFormat
[civicrm-core.git] / CRM / Utils / Money.php
index 786fccd64c0bbc4e4981a5bf3b9a48c30a09217e..08119a54023318098484e5a8afeca9654e4dd4db 100644 (file)
@@ -43,14 +43,12 @@ class CRM_Utils_Money {
    * @param string $format
    *   The desired currency format.
    * @param bool $onlyNumber
-   * @param string $valueFormat
-   *   The desired monetary value display format (e.g. '%!i').
    *
    * @return string
    *   formatted monetary string
    *
    */
-  public static function format($amount, $currency = NULL, $format = NULL, $onlyNumber = FALSE, $valueFormat = NULL) {
+  public static function format($amount, $currency = NULL, $format = NULL, $onlyNumber = FALSE) {
 
     if (CRM_Utils_System::isNull($amount)) {
       return '';
@@ -62,14 +60,6 @@ class CRM_Utils_Money {
       $format = $config->moneyformat;
     }
 
-    if (!$valueFormat) {
-      $valueFormat = $config->moneyvalueformat;
-    }
-
-    if (!empty($valueFormat) && $valueFormat !== '%!i') {
-      CRM_Core_Error::deprecatedWarning('Having a Money Value format other than %!i is deprecated, please report this on the GitLab Issue https://lab.civicrm.org/dev/core/-/issues/1494 with the relevant moneyValueFormat you use.');
-    }
-
     if (!$currency) {
       $currency = $config->defaultCurrency;
     }
@@ -96,7 +86,7 @@ class CRM_Utils_Money {
       CRM_Core_Error::deprecatedWarning('Passing empty currency to CRM_Utils_Money::format is deprecated if you need it for display without currency call CRM_Utils_Money::formatLocaleNumericRounded');
     }
 
-    $amount = self::formatNumericByFormat($amount, $valueFormat);
+    $amount = self::formatNumericByFormat($amount);
     // If it contains tags, means that HTML was passed and the
     // amount is already converted properly,
     // so don't mess with it again.
@@ -181,10 +171,7 @@ class CRM_Utils_Money {
    * @return string
    */
   protected static function formatLocaleNumeric($amount) {
-    if (CRM_Core_Config::singleton()->moneyvalueformat !== '%!i') {
-      CRM_Core_Error::deprecatedWarning('Having a Money Value format other than !%i is deprecated, please report this on GitLab with the relevant moneyValueFormat you use.');
-    }
-    return self::formatNumericByFormat($amount, CRM_Core_Config::singleton()->moneyvalueformat);
+    return self::formatNumericByFormat($amount);
   }
 
   /**
@@ -304,7 +291,7 @@ class CRM_Utils_Money {
    *
    * @return string
    */
-  protected static function formatNumericByFormat($amount, $valueFormat) {
+  protected static function formatNumericByFormat($amount, $valueFormat = '%!i') {
     // money_format() exists only in certain PHP install (CRM-650)
     // setlocale() affects native gettext (CRM-11054, CRM-9976)
     if (is_numeric($amount) && function_exists('money_format')) {