• Модуль: tasks
  • Путь к файлу: ~/bitrix/modules/tasks/lib/checklist/checklistfacade.php
  • Класс: BitrixTasksCheckListCheckListFacade
  • Вызов: CheckListFacade::delete
static function delete($entityId, $userId, $checkList)
{
	$deleteResult = new Result();

	$items = static::getByEntityId($entityId);
	$itemsTree = static::getObjectStructuredRoots($items, $entityId, $userId);

	$id = $checkList->getFields()['ID'];
	$checkListWithSubTree = null;

	/** @var CheckList $item */
	foreach ($itemsTree as $item)
	{
		if ($checkListWithSubTree = $item->findById($id))
		{
			break;
		}
	}

	if ($checkListWithSubTree !== null)
	{
		$deleteCompositeResult = static::deleteComposite($entityId, $userId, $checkListWithSubTree);
		if (!$deleteCompositeResult->isSuccess())
		{
			$deleteResult->loadErrors($deleteCompositeResult->getErrors());
			return $deleteResult;
		}
	}

	return $deleteResult;
}