• Модуль: tasks
  • Путь к файлу: ~/bitrix/modules/tasks/lib/checklist/internals/checklisttree.php
  • Класс: BitrixTasksCheckListInternalsCheckListTree
  • Вызов: CheckListTree::canAttach
static function canAttach($id, $parentId = 0)
{
	$result = new Result();

	$id = (int)$id;
	$parentId = (int)$parentId;

	$replaces = [
		'#ID#' => $id,
		'#PARENT_ID#' => $parentId,
	];

	if (!$id)
	{
		$result = static::addErrorToResult($result, $replaces, __METHOD__, 'ILLEGAL_NODE');
	}
	else if ($parentId)
	{
		if ($id === $parentId)
		{
			$result = static::addErrorToResult($result, $replaces, __METHOD__, 'SELF_ATTACH');
		}
		else if (static::isPathExist($id, $parentId))
		{
			$result = static::addErrorToResult($result, $replaces, __METHOD__, 'CHILD_ATTACH');
		}
	}

	return $result;
}