Fixes DMP editor's Funder updating mechanics.

This commit is contained in:
gkolokythas 2019-08-28 11:52:07 +03:00
parent 3d3963f5c1
commit 71aea010a9
1 changed files with 11 additions and 7 deletions

View File

@ -293,10 +293,14 @@ public class DataManagementPlanEditorModel implements DataModel<DMP, DataManagem
} }
} }
if (this.funder != null && this.funder.getExistFunder() != null) { if(this.funder == null && this.funder.getExistFunder() == null && this.funder.getLabel() == null) {
if (this.funder.getExistFunder() != null && this.funder.getLabel() == null) dataManagementPlanEntity.getGrant().setFunder(null);
dataManagementPlanEntity.getGrant().setFunder(this.funder.getExistFunder().toDataModel()); }
else if (this.funder != null && this.funder.getExistFunder() == null && this.funder.getLabel() == null) {
dataManagementPlanEntity.getGrant().setFunder(null);
}
else { else {
if (this.funder.getLabel() != null) {
Funder funder = new Funder(); Funder funder = new Funder();
funder.setLabel(this.funder.getLabel()); funder.setLabel(this.funder.getLabel());
funder.setType(Funder.FunderType.INTERNAL.getValue()); funder.setType(Funder.FunderType.INTERNAL.getValue());
@ -308,9 +312,9 @@ public class DataManagementPlanEditorModel implements DataModel<DMP, DataManagem
dataManagementPlanEntity.getGrant().setFunder(funder); dataManagementPlanEntity.getGrant().setFunder(funder);
} }
else if (this.funder.getExistFunder() != null && this.funder.getLabel() == null){
dataManagementPlanEntity.getGrant().setFunder(this.funder.getExistFunder().toDataModel());
} }
else {
dataManagementPlanEntity.getGrant().setFunder(null);
} }
if (this.project != null) { if (this.project != null) {