- Модуль: tasks
- Путь к файлу: ~/bitrix/modules/tasks/lib/scrum/controllers/dod.php
- Класс: BitrixTasksScrumControllersDoD
- Вызов: DoD::saveListAction
public function saveListAction(int $taskId, int $typeId, array $items = []): ?string
{
$userId = User::getId();
$itemService = new ItemService();
$typeService = new TypeService();
$entityService = new EntityService();
$definitionOfDoneService = new DefinitionOfDoneService($userId);
$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;
}
$scrumItem = $itemService->getItemBySourceId($taskId);
if ($scrumItem->isEmpty())
{
$this->errorCollection->setError(
new Error(
Loc::getMessage('TASKS_SCRUM_DEFINITION_OF_DONE_SAVE_ITEM_ERROR'),
self::ERROR_COULD_NOT_SAVE_ITEM_LIST
)
);
return null;
}
$scrumItem->setTypeId($type->getId());
$itemService->changeItem($scrumItem);
$result = $definitionOfDoneService->mergeList(
ItemChecklistFacade::class,
$scrumItem->getId(),
$items
);
if ($result->isSuccess())
{
return '';
}
else
{
$this->errorCollection->setError(
new Error(
Loc::getMessage('TASKS_SCRUM_DEFINITION_OF_DONE_SAVE_ITEM_ERROR'),
self::ERROR_COULD_NOT_SAVE_ITEM_LIST
)
);
return null;
}
}