- Модуль: iblock
- Путь к файлу: ~/bitrix/modules/iblock/lib/bizproctype/money.php
- Класс: BitrixIblockBizprocTypeMoney
- Вызов: Money::formatValuePrintable
static function formatValuePrintable(FieldType $fieldType, $value)
{
$explode = is_string($value) ? explode(IblockMoneyProperty::SEPARATOR, $value) : array();
$currentValue = $explode[0] ? $explode[0] : '';
$currentCurrency = $explode[1] ? $explode[1] : '';
if(!$currentCurrency)
return intval($currentValue) ? $currentValue : '';
if (
CurrencyManager::isCurrencyExist($currentCurrency)
&& filter_var($currentValue, FILTER_VALIDATE_INT|FILTER_VALIDATE_FLOAT) !== false
)
{
//TODO: replace to CCurrencyLang::formatValue after refactoring currency for support really big prices (more than float)
$format = CCurrencyLang::getCurrencyFormat($currentCurrency);
$separators = CCurrencyLang::getSeparators();
$thousandsSep = $separators[$format['THOUSANDS_VARIANT']];
$currentValue = number_format((float)$currentValue, $format['DECIMALS'], $format['DEC_POINT'], $thousandsSep);
if($format['THOUSANDS_VARIANT'] == CCurrencyLang::SEP_NBSPACE)
$currentValue = str_replace(' ', ' ', $currentValue);
return preg_replace('/(^|[^&])#/', '${1}'.$currentValue, $format['FORMAT_STRING']);
}
return $currentValue;
}