Skip to content
Snippets Groups Projects
Commit 2c40d2ee authored by srosse's avatar srosse
Browse files

OO-3289: fix selection of organisation in curriculum

parent fe0dedc1
No related branches found
No related tags found
No related merge requests found
......@@ -86,7 +86,7 @@ public class CurriculumImpl implements Persistable, Curriculum {
private Group group;
@ManyToOne(targetEntity=OrganisationImpl.class,fetch=FetchType.LAZY,optional=true)
@JoinColumn(name="fk_organisation", nullable=true, insertable=true, updatable=false)
@JoinColumn(name="fk_organisation", nullable=true, insertable=true, updatable=true)
private Organisation organisation;
@Override
......
......@@ -179,15 +179,16 @@ public class EditCurriculumController extends FormBasicController {
@Override
protected void formOK(UserRequest ureq) {
//create a new one
Organisation organisation;
if(organisationEl != null && organisationEl.isOneSelected()) {
organisation = organisationService
.getOrganisation(new OrganisationRefImpl(Long.valueOf(organisationEl.getSelectedKey())));
} else {
organisation = organisationService.getDefaultOrganisation();
}
if(curriculum == null) {
//create a new one
Organisation organisation;
if(organisationEl != null && organisationEl.isOneSelected()) {
organisation = organisationService
.getOrganisation(new OrganisationRefImpl(Long.valueOf(organisationEl.getSelectedKey())));
} else {
organisation = organisationService.getDefaultOrganisation();
}
curriculum = curriculumService
.createCurriculum(identifierEl.getValue(), displayNameEl.getValue(), descriptionEl.getValue(), organisation);
curriculumService.addMember(curriculum, getIdentity(), CurriculumRoles.curriculummanager);
......@@ -196,6 +197,7 @@ public class EditCurriculumController extends FormBasicController {
curriculum.setIdentifier(identifierEl.getValue());
curriculum.setDisplayName(displayNameEl.getValue());
curriculum.setDescription(descriptionEl.getValue());
curriculum.setOrganisation(organisation);
curriculum = curriculumService.updateCurriculum(curriculum);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment