• Модуль: tasks
  • Путь к файлу: ~/bitrix/modules/tasks/lib/checklist/task/taskchecklistfacade.php
  • Класс: BitrixTasksCheckListTaskTaskCheckListFacade
  • Вызов: TaskCheckListFacade::onAfterMerge
static function onAfterMerge(array $traversedItems, int $userId, int $taskId, array $parameters): void
{
	if (
		isset($parameters['context'])
		&& $parameters['context'] === self::TASK_ADD_CONTEXT
	)
	{
		return;
	}
	$task = TaskRegistry::getInstance()->getObject($taskId);
	if (is_null($task))
	{
		return;
	}

	$newRootItems = array_filter($traversedItems,
		static fn (array $item): bool => (int)$item['PARENT_ID'] === 0
	);
	$newRootItemKeys = array_values(array_map(
		static fn (array $item): int => (int)$item['ID'],
		$newRootItems
	));

	$oldRootItems = array_filter(static::$oldItemsToMerge,
		static fn (array $item): bool => (int)$item['PARENT_ID'] === 0
	);
	$oldRootItemKeys = array_keys($oldRootItems);

	$timeline = new TimeLineManager($taskId, $userId);
	if (!empty(array_diff($newRootItemKeys, $oldRootItemKeys)))
	{
		$timeline->onTaskChecklistAdded();
	}
	else
	{
		$timeline->onTaskChecklistChanged();
	}
	$timeline->save();
}