dmp profile bug fixes: 1) dmp profile was not saved 2) if you select external autocomplete field and change it to another type, the external field was saved

This commit is contained in:
Bernaldo Mihasi 2023-06-21 12:20:30 +03:00
parent 34e4761811
commit 3630727fed
2 changed files with 10 additions and 0 deletions

View File

@ -477,6 +477,10 @@ public class DataManagementPlanManager {
}
DMP newDmp = dataManagementPlan.toDataModel();
if(dataManagementPlan.getProfile() != null){
DMPProfile dmpProfile = apiContext.getOperationsContext().getDatabaseRepository().getDmpProfileDao().find(dataManagementPlan.getProfile().getId());
newDmp.setProfile(dmpProfile);
}
if (newDmp.getStatus() == (int) DMP.DMPStatus.FINALISED.getValue()) {
checkDmpValidationRules(newDmp);
}

View File

@ -245,6 +245,7 @@ export class DmpProfileEditorComponent extends BaseComponent implements AfterVie
this.addControl(formGroup);
return true;
} else {
this.removeControl(formGroup);
return false;
}
}
@ -253,4 +254,9 @@ export class DmpProfileEditorComponent extends BaseComponent implements AfterVie
if (formGroup.get('dataType').value == 3)
formGroup.addControl('externalAutocomplete', new DmpProfileExternalAutoCompleteFieldDataEditorModel().buildForm());
}
removeControl(formGroup: FormGroup) {
if (formGroup.get('dataType').value != 3)
formGroup.removeControl('externalAutocomplete');
}
}