• Модуль: crm
  • Путь к файлу: ~/bitrix/modules/crm/lib/Service/Operation/Action/Compatible/SendEvent/WithCancel/Delete.php
  • Класс: Bitrix\Crm\Service\Operation\Action\Compatible\SendEvent\WithCancel\Delete
  • Вызов: Delete::executeEvent
protected function executeEvent(array $event, Item $item): Result
{
	global $APPLICATION;
	$result = new Result();

	$eventResult = ExecuteModuleEventEx($event, [$item->getId()]);
	if ($eventResult === false)
	{
		$message = $fields['RESULT_MESSAGE'] ?? Loc::getMessage(static::DEFAULT_CANCELED_MESSAGE_CODE, [
			'#NAME#' => $event['TO_NAME'],
			'#EVENT#' => $this->eventName,
		]);
		if ($exception = $APPLICATION->GetException())
		{
			$message .= ': ' . $exception->GetString();
			if ($exception->GetID() === 'system')
			{
				$message = $exception->GetString();
			}
		}
		$APPLICATION->throwException($message);

		$result->addError(new Error($message, static::ERROR_CODE_TERMINATED_BY_EVENT_COMPATIBLE));
	}

	return $result;
}