• Модуль: crmmobile
  • Путь к файлу: ~/bitrix/modules/crmmobile/lib/Controller/Stage.php
  • Класс: BitrixCrmMobileControllerStage
  • Вызов: Stage::deleteAction
public function deleteAction(Factory $factory, string $statusId): bool
{
	$stage = $factory->getStage($statusId);

	if (!$stage)
	{
		$this->addError(new Error(Loc::getMessage('CRM_STAGE_STAGE_NOT_FOUND')));
		return false;
	}

	if (!Container::getInstance()->getUserPermissions()->canWriteConfig())
	{
		$this->addError(ErrorCode::getAccessDeniedError());
		return false;
	}

	if ($stage->getSystem())
	{
		$this->addError(new Error(Loc::getMessage('CRM_STAGE_STAGE_IS_SYSTEM')));
		return false;
	}

	$result = $stage->delete();

	if (!$result->isSuccess())
	{
		$this->addErrors($result->getErrors());
		return false;
	}

	return true;
}