* @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 '';
$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;
}
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.
* @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);
}
/**
*
* @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')) {