• Модуль: crm
  • Путь к файлу: ~/bitrix/modules/crm/lib/Reservation/Component/InventoryManagement.php
  • Класс: Bitrix\Crm\Reservation\Component\InventoryManagement
  • Вызов: InventoryManagement::processInternal
private function processInternal(): Main\Result
{
	$result = new Main\Result();

	$semanticId =
		$this->itemAfterSave->hasField(Crm\Item::FIELD_NAME_STAGE_SEMANTIC_ID)
			? $this->itemAfterSave->getStageSemanticId()
			: null
	;

	$processInventoryManagementResult = null;
	if ($semanticId === Crm\PhaseSemantics::SUCCESS)
	{
		$processInventoryManagementResult = $this->ship();
		if ($processInventoryManagementResult->isSuccess())
		{
			$processInventoryManagementResult = $this->unReserve();
		}
	}
	elseif ($semanticId === Crm\PhaseSemantics::FAILURE)
	{
		$processInventoryManagementResult = $this->unReserve();
	}

	if ($processInventoryManagementResult && !$processInventoryManagementResult->isSuccess())
	{
		Crm\Activity\Provider\StoreDocument::addProductActivity($this->itemAfterSave->getId());

		$result->addError(Crm\Reservation\Error\InventoryManagementError::create());
	}

	return $result;
}