• Модуль: crm
  • Путь к файлу: ~/bitrix/modules/crm/lib/update/product/priceaccount.php
  • Класс: Bitrix\Crm\Update\Product\PriceAccount
  • Вызов: PriceAccount::updatePriceAccount
protected function updatePriceAccount(array $options): array
{
	$found = false;
	$iterator = Crm\ProductRowTable::getList(
		$this->getProductListParameters($options)
	);
	while ($row = $iterator->fetch())
	{
		$found = true;
		$row['ID'] = (int)$row['ID'];
		$row['OWNER_ID'] = (int)$row['OWNER_ID'];
		$row['PRICE'] = (float)$row['PRICE'];

		$ownerData = $this->getOwnerData($row);
		if (!empty($ownerData))
		{
			$accountData = \CCrmAccountingHelper::PrepareAccountingData([
				'CURRENCY_ID' => $ownerData['CURRENCY_ID'],
				'SUM' => $row['PRICE'] ?? null,
				'EXCH_RATE' => $ownerData['EXCH_RATE'] ?? null
			]);

			if (is_array($accountData))
			{
				$this->connection->query($this->query[self::QUERY_UPDATE]
					. $accountData['ACCOUNT_SUM']
					. $this->query[self::QUERY_WHERE] . $row['ID']
				);
			}
		}
		$options['lastId'] = $row['ID'];
		$options['steps']++;
	}

	if (!$found)
	{
		$options = [];
	}

	return $options;
}