Task::copyChildTasks

  1. Bitrix24 API (v. 23.675.0)
  2. tasks
  3. Task
  4. copyChildTasks
  • Модуль: tasks
  • Путь к файлу: ~/bitrix/modules/tasks/lib/copy/implement/task.php
  • Класс: BitrixTasksCopyImplementTask
  • Вызов: Task::copyChildTasks
private function copyChildTasks($taskId, $copiedTaskId)
{
	if (!$this->taskCopier)
	{
		return new Result();
	}

	$filter = ["PARENT_ID" => $taskId];
	$groupId = $this->getGroupIdByTaskId($taskId);
	if ($groupId)
	{
		$filter["GROUP_ID"] = $groupId;
	}

	$containerCollection = new ContainerCollection();

	$queryObject = $this->getList([], $filter, ["ID"]);
	while ($task = $queryObject->fetch())
	{
		$container = new Container($task["ID"]);
		$container->setParentId($copiedTaskId);
		$containerCollection[] = $container;
	}

	if (!$containerCollection->isEmpty())
	{
		return $this->taskCopier->copy($containerCollection);
	}

	return new Result();
}

Добавить комментарий