...Человеческий поиск в разработке...
- Модуль: crm
- Путь к файлу: ~/bitrix/modules/crm/lib/controller/item/productrow.php
- Класс: Bitrix\Crm\Controller\Item\ProductRow
- Вызов: ProductRow::prepareForSave
protected function prepareForSave($productRows): array { $result = []; $fieldsInfo = $this->getFieldsInfo(); foreach ($productRows as $index => $productRow) { $internalizedFields = $this->internalizeFields($productRow, $fieldsInfo); if ($internalizedFields) { $result[$index] = $internalizedFields; } if (isset($productRow['TAX_RATE'])) { if ( (float)$productRow['TAX_RATE'] > 0 || $productRow['TAX_RATE'] === 0 || ( is_string($productRow['TAX_RATE']) && isset($productRow['TAX_RATE'][0]) && $productRow['TAX_RATE'][0] === '0' ) ) { $result[$index]['TAX_RATE'] = (float)$productRow['TAX_RATE']; } else { $result[$index]['TAX_RATE'] = null; } } } $productIds = array_filter(array_column($result, 'PRODUCT_ID')); if ($productIds && Loader::includeModule('catalog')) { $productData = []; $productTableIterator = Catalog\ProductTable::getList([ 'select' => [ 'ID', 'PRODUCT_NAME' => 'IBLOCK_ELEMENT.NAME', 'TYPE', ], 'filter' => [ '@ID' => $productIds, ], ]); while ($productItem = $productTableIterator->fetch()) { $productData[$productItem['ID']] = $productItem; } foreach ($result as $index => $productRow) { $productId = $productRow['PRODUCT_ID'] ?? null; if ($productId && isset($productData[$productId])) { $result[$index]['TYPE'] = (int)$productData[$productId]['TYPE']; $result[$index]['PRODUCT_NAME'] ??= $productData[$productId]['PRODUCT_NAME']; } } } return $result; }