Fixes bug on not creating finalized DMP.

This commit is contained in:
gkolokythas 2019-06-24 11:01:28 +03:00
parent 695ce63343
commit 4aedfdd7f6
1 changed files with 4 additions and 3 deletions

View File

@ -397,9 +397,10 @@ public class DataManagementPlanManager {
public void createOrUpdate(ApiContext apiContext, DataManagementPlanEditorModel dataManagementPlan, Principal principal) throws Exception {
DMP dmp1 = apiContext.getOperationsContext().getDatabaseRepository().getDmpDao().find(dataManagementPlan.getId());
if (dmp1.getStatus().equals(DMP.DMPStatus.FINALISED.getValue())) {
throw new Exception("DMP is finalized, therefore cannot be edited.");
if (dataManagementPlan.getStatus() == (int) DMP.DMPStatus.FINALISED.getValue() && dataManagementPlan.getId() != null) {
DMP dmp1 = apiContext.getOperationsContext().getDatabaseRepository().getDmpDao().find(dataManagementPlan.getId());
if (dmp1.getStatus().equals(DMP.DMPStatus.FINALISED.getValue()))
throw new Exception("DMP is finalized, therefore cannot be edited.");
}
DMP newDmp = dataManagementPlan.toDataModel();