Fixes bug on enabling a Finalized DMP to be made Draft again.

This commit is contained in:
gkolokythas 2019-06-21 12:31:15 +03:00
parent e76eb24dbd
commit c5d00b9ba1
1 changed files with 4 additions and 1 deletions

View File

@ -424,9 +424,12 @@ public class DataManagementPlanManager {
createOrganisationsIfTheyDontExist(newDmp, apiContext.getOperationsContext().getDatabaseRepository().getOrganisationDao());
createResearchersIfTheyDontExist(newDmp, apiContext.getOperationsContext().getDatabaseRepository().getResearcherDao());
createProjectIfItDoesntExist(newDmp, apiContext.getOperationsContext().getDatabaseRepository().getProjectDao(), user);
DMP dmp = apiContext.getOperationsContext().getDatabaseRepository().getDmpDao().find(dataManagementPlan.getId());
if (dmp.getStatus().equals(DMP.DMPStatus.FINALISED.getValue()))
newDmp.setStatus(DMP.DMPStatus.FINALISED.getValue());
try {
DMP dmp = apiContext.getOperationsContext().getDatabaseRepository().getDmpDao().find(dataManagementPlan.getId());
newDmp.setCreated(dmp.getCreated());
if (dmp.getUsers().stream().filter(userInfo -> userInfo.getUser().getId() == principal.getId())
.collect(Collectors.toList()).size() == 0) {