Skip to content

Commit

Permalink
Fix value validations when updating locked phases
Browse files Browse the repository at this point in the history
(refs #1108)

Change-Id: I14aa120375e67b10d81b84ec3ef171dd284f6645
  • Loading branch information
tdegivry authored and osarrat committed Jan 30, 2018
1 parent f5b3c72 commit 884b660
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions src/main/java/org/sigmah/server/handler/UpdateProjectHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -340,8 +340,20 @@ private List<String> searchForConflicts(final Project project, final List<ValueE

if (projectIsClosed || phaseIsClosed || (source.getAmendable() && projectIsLocked)) {
final ValueResult result = new ValueResult();
result.setValueObject(value.getSingleValue());
result.setValuesObject(value.getTripletValue() != null ? Collections.<ListableValue>singletonList(value.getTripletValue()) : null);

final String updateSingleValue = value.getSingleValue();
final TripletValueDTO updateListValue = value.getTripletValue();
final Set<Integer> multivaluedIdsValue = value.getMultivaluedIdsValue();

if (updateSingleValue != null) {
result.setValueObject(updateSingleValue);
} else if (updateListValue != null) {
result.setValuesObject(Collections.<ListableValue>singletonList(value.getTripletValue()));
} else if (multivaluedIdsValue != null) {
result.setValueObject(ValueResultUtils.mergeElements(new ArrayList<Integer>(multivaluedIdsValue)));
} else {
LOGGER.warn("Empty value event received for element #{} ({}) of container #{}.", source.getId(), source.getEntityName(), project.getId());
}

if(!source.isCorrectRequiredValue(result)) {
conflicts.add(i18nServer.t(language, "conflictModifyLockedContentEmptyValue",
Expand Down

0 comments on commit 884b660

Please sign in to comment.