• Модуль: crm
  • Путь к файлу: ~/bitrix/modules/crm/lib/entity/compatibility/adapter/operation.php
  • Класс: Bitrix\Crm\Entity\Compatibility\Adapter\Operation
  • Вызов: Operation::doPerformDelete
protected function doPerformDelete(int $id, array $compatibleOptions): Result
{
	global $APPLICATION;
	$APPLICATION->ResetException();

	$this->beforeStart();

	$item = $this->factory->getItem($id);
	if(!$item)
	{
		// only 'delete' throws application exception if the item is not found
		$APPLICATION->ThrowException($this->getNotFoundErrorMessage());

		return $this->returnNotFoundError();
	}

	$operation = $this->factory->getDeleteOperation($item);

	$this->prepareOperation($operation, $compatibleOptions);
	// force bizproc deletion regardless of adapter settings
	$processBizproc = (bool)($compatibleOptions['PROCESS_BIZPROC'] ?? true);
	if ($processBizproc)
	{
		$operation->enableBizProc();
		$operation->enableAutomation();
	}
	else
	{
		$operation->disableBizProc();
		$operation->disableAutomation();
	}

	$result = $operation->launch();
	if (!$result->isSuccess())
	{
		return $this->returnError($result);
	}

	return $this->returnSuccess(true);
}