From 5a76e6281ed705bdc29a888c2bdf3263d818f3d8 Mon Sep 17 00:00:00 2001 From: Manuel Rego Casasnovas Date: Wed, 5 Dec 2012 11:05:38 +0100 Subject: [PATCH] Bug #1589: Fix issue using orderVersion for all the elements to be updated or added FEA: ItEr77S04BugFixing --- .../ws/common/impl/OrderElementConverter.java | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/libreplan-webapp/src/main/java/org/libreplan/ws/common/impl/OrderElementConverter.java b/libreplan-webapp/src/main/java/org/libreplan/ws/common/impl/OrderElementConverter.java index 926d4e2ef..7e699e5af 100644 --- a/libreplan-webapp/src/main/java/org/libreplan/ws/common/impl/OrderElementConverter.java +++ b/libreplan-webapp/src/main/java/org/libreplan/ws/common/impl/OrderElementConverter.java @@ -542,14 +542,22 @@ public final class OrderElementConverter { OrderElementDTO orderElementDTO, ConfigurationOrderElementConverter configuration) throws ValidationException { - updateExceptCriterionRequirements(orderElement, orderElementDTO, - configuration); + update(null, orderElement, orderElementDTO, configuration); + } + + private final static void update(OrderVersion orderVersion, + OrderElement orderElement, OrderElementDTO orderElementDTO, + ConfigurationOrderElementConverter configuration) + throws ValidationException { + updateExceptCriterionRequirements(orderVersion, orderElement, + orderElementDTO, configuration); if (configuration.isCriterionRequirements()) { addOrCriterionRequirements(orderElement, orderElementDTO); } } private final static void updateExceptCriterionRequirements( + OrderVersion orderVersion, OrderElement orderElement, OrderElementDTO orderElementDTO, ConfigurationOrderElementConverter configuration) throws ValidationException { @@ -577,7 +585,6 @@ public final class OrderElementConverter { } } } else { // orderElementDTO instanceof OrderLineGroupDTO - OrderVersion orderVersion = null; if (orderElementDTO instanceof OrderDTO) { if (!(orderElement instanceof Order)) { throw new ValidationException(MessageFormat.format( @@ -623,7 +630,8 @@ public final class OrderElementConverter { for (OrderElementDTO childDTO : ((OrderLineGroupDTO) orderElementDTO).children) { if (orderElement.containsOrderElement(childDTO.code)) { - update(orderElement.getOrderElement(childDTO.code), + update(orderVersion, + orderElement.getOrderElement(childDTO.code), childDTO, configuration); } else { if (checkConstraintUniqueOrderCode(childDTO)) {