• Модуль: crm
  • Путь к файлу: ~/bitrix/modules/crm/lib/category/dealcategory.php
  • Класс: Bitrix\Crm\Category\DealCategory
  • Вызов: DealCategory::delete
static function delete($ID)
{
	if(!self::exists($ID))
	{
		throw new DeleteException(\CCrmOwnerType::DealCategory, $ID, array(), DeleteException::NOT_FOUND);
	}

	if(self::hasDependencies($ID))
	{
		throw new DeleteException(\CCrmOwnerType::DealCategory, $ID, array(), DeleteException::DEPENDENCIES_FOUND);
	}

	/** @var Main\Entity\DeleteResult $result */
	$result = null;
	try
	{
		$result = DealCategoryTable::delete($ID);
	}
	catch(\Exception $ex)
	{
		throw new DeleteException(\CCrmOwnerType::DealCategory, $ID, array($ex->getMessage()), 0, '', 0, $ex);
	}

	$success = $result->isSuccess();
	if(!$success)
	{
		throw new DeleteException(\CCrmOwnerType::DealCategory, $ID, $result->getErrorMessages());
	}

	unset(self::$existMap[$ID]);
	self::eraseStages($ID);
	self::erasePermissions($ID);

	if(self::$all !== null)
	{
		self::$all = null;
	}
}