- Модуль: tasks
- Путь к файлу: ~/bitrix/modules/tasks/lib/checklist/internals/checklist.php
- Класс: BitrixTasksCheckListInternalsCheckList
- Вызов: CheckList::recountSortIndexes
private function recountSortIndexes($connection)
{
$facade = $this->facade;
$entityId = $this->fields->getEntityId();
$parentId = $this->fields->getParentId();
$sortIndex = $this->fields->getSortIndex();
$items = $facade::getList(['ID', 'SORT_INDEX'], [$facade::$entityIdName => $entityId, 'PARENT_ID' => $parentId]);
$sortIndexes = array_column($items, 'SORT_INDEX', 'ID');
if (in_array($sortIndex, $sortIndexes))
{
$recountedSortIndexes = $this->getRecountedSortIndexes($sortIndexes, $sortIndex);
try
{
$this->updateItemsWithRecountedSortIndexes($recountedSortIndexes, $connection);
}
catch (SqlQueryException $exception)
{
$facade::logError($exception->getMessage());
}
}
}