• Модуль: crm
  • Путь к файлу: ~/bitrix/modules/crm/lib/controller/timeline/logmessage.php
  • Класс: Bitrix\Crm\Controller\Timeline\LogMessage
  • Вызов: LogMessage::deleteAction
public function deleteAction(int $id, \CRestServer $server): ?bool
{
	if (!$this->isAdmin())
	{
		$this->addError(ErrorCode::getAccessDeniedError());

		return null;
	}

	$item = $this->getTimelineItem($id);

	if (!$item)
	{
		$this->addError(new Error("Log message not found for id `$id`", ErrorCode::NOT_FOUND));
		return null;
	}

	if (!$this->checkClientId($item, $server))
	{
		$this->addError(new Error(
			'This log message can only be deleted by the application through which it was created',
			ErrorCode::REMOVING_DISABLED)
		);
		return null;
	}

	$result = $this->delete($item);
	if ($result->isSuccess())
	{
		return true;
	}

	foreach ($result->getErrors() as $error)
	{
		$this->addError($error);
	}

	return null;
}