• Модуль: tasks
  • Путь к файлу: ~/bitrix/modules/tasks/lib/scrum/controllers/dod.php
  • Класс: BitrixTasksScrumControllersDoD
  • Вызов: DoD::getListAction
public function getListAction(int $groupId, int $taskId, int $typeId): ?Component
{
	$userId = User::getId();

	$backlogService = new BacklogService();
	$itemService = new ItemService();
	$typeService = new TypeService();
	$entityService = new EntityService();

	$type = $typeService->getType($typeId);
	if ($type->isEmpty())
	{
		$this->errorCollection->setError(
			new Error(
				Loc::getMessage('TASKS_SDC_ERROR_TYPE_NOT_FOUND'),
				self::ERROR_COULD_NOT_SAVE_SETTINGS
			)
		);

		return null;
	}

	$entity = $entityService->getEntityById($type->getEntityId());
	if (!Group::canReadGroupTasks($userId, $entity->getGroupId()))
	{
		$this->errorCollection->setError(
			new Error(
				Loc::getMessage('TASKS_SDC_ERROR_ACCESS_DENIED'),
				self::ERROR_ACCESS_DENIED
			)
		);

		return null;
	}

	$definitionOfDoneService = new DefinitionOfDoneService($userId);

	$backlog = $backlogService->getBacklogByGroupId($groupId);
	$item = $itemService->getItemBySourceId($taskId);

	if ($item->isEmpty() || $backlogService->getErrors() || $backlog->isEmpty())
	{
		$this->errorCollection->setError(new Error('System error', self::ERROR_COULD_NOT_GET_DATA));

		return null;
	}

	if (
		$this->isItemListEmpty($item->getId(), $userId)
		|| $item->getTypeId() !== $typeId
	)
	{
		$typeItems = $definitionOfDoneService->getTypeItems($typeId);

		$items = $this->convertTypeItems($item->getId(), $typeItems);
	}
	else
	{
		$items = $this->getItemItems($item->getId(), $userId);
	}

	return $definitionOfDoneService->getComponent($item->getId(), 'SCRUM_ITEM', $items);
}