Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
purchasingpricefieldassembler.php
1<?php
2
4
7use CCurrencyLang;
8
10{
11 private const PRICE_COLUMN = 'PURCHASING_PRICE';
12 private const CURRENCY_COLUMN = 'PURCHASING_CURRENCY';
13
14 public function __construct()
15 {
16 parent::__construct([
17 self::PRICE_COLUMN,
18 ]);
19 }
20
21 protected function prepareRow(array $row): array
22 {
23 $priceValue = $row['data'][self::PRICE_COLUMN] ?? null;
24 $currencyValue = $row['data'][self::CURRENCY_COLUMN] ?? null;
25
26 if (Loader::includeModule('currency'))
27 {
28 $row['columns'][self::PRICE_COLUMN] = CCurrencyLang::CurrencyFormat(
29 $priceValue,
30 $currencyValue
31 );
32 }
33 else
34 {
35 $row['columns'][self::PRICE_COLUMN] = $priceValue;
36 }
37
38 $row['data']['~' . self::PRICE_COLUMN] = [
39 'PRICE' => [
40 'NAME' => 'PRICE',
41 'VALUE' => $priceValue,
42 ],
43 'CURRENCY' => [
44 'NAME' => 'CURRENCY',
45 'VALUE' => $currencyValue,
46 ],
47 ];
48
49 return $row;
50 }
51}