• Модуль: crm
  • Путь к файлу: ~/bitrix/modules/crm/lib/Reservation/Actions/SynchronizeReservesOnUpdate.php
  • Класс: Bitrix\Crm\Reservation\Actions\SynchronizeReservesOnUpdate
  • Вызов: SynchronizeReservesOnUpdate::process
public function process(Item $item): Result
{
	$result = new Result();

	$isAfterOperation = $this->getItemBeforeSave() !== null;
	if ($this->isFirstRun && $isAfterOperation)
	{
		$result->addError(
			new Error('Action can only be executing on both steps at once (before and after saving)')
		);
		return $result;
	}

	// runs and before, and after for processing new product rows (by before step the rows not contains ID)
	$productRows = $item->getProductRows();
	if ($productRows instanceof ProductRowCollection)
	{
		$this->fillReservationResult($productRows);
	}

	if ($this->isFirstRun)
	{
		$this->isFirstRun = false;
	}
	else
	{
		$this->synchronizeReserves($item->getId());
	}

	return $result;
}