...Человеческий поиск в разработке...
- Модуль: tasks
- Путь к файлу: ~/bitrix/modules/tasks/lib/control/template.php
- Класс: BitrixTasksControlTemplate
- Вызов: Template::safeDelete
private function safeDelete() { $connection = Application::getConnection(); $connection->queryExecute('UPDATE b_tasks_template SET ZOMBIE = 'Y' WHERE ID = ' . $this->templateId); $this->removeAgents(); $parent = DependenceTable::getParentId($this->templateId)->fetch(); $parentId = $parent['PARENT_TEMPLATE_ID']; $subTree = DependenceTable::getSubTree($this->templateId, [], ['INCLUDE_SELF' => false])->fetchAll(); // delete link to parent DependenceTable::unlink($this->templateId); // reattach sub templates if ($parentId) { foreach ($subTree as $element) { if ($element['DIRECT'] == 1) { DependenceTable::moveLink($element['TEMPLATE_ID'], $parentId); } } } else { foreach ($subTree as $element) { if ($element['DIRECT'] == 1) { DependenceTable::unlink($element['TEMPLATE_ID']); } } } // delete item itself $select = ['TEMPLATE_ID', 'PARENT_TEMPLATE_ID']; $filter = [ '=TEMPLATE_ID' => $this->templateId, '=PARENT_TEMPLATE_ID' => $this->templateId ]; $item = DependenceTable::getList(['select' => $select, 'filter' => $filter])->fetch(); DependenceTable::delete($item); }