Author: jleroux
Date: Thu Mar 16 07:17:40 2017 New Revision: 1787134 URL: http://svn.apache.org/viewvc?rev=1787134&view=rev Log: "Applied fix from trunk framework for revision: 1787133 " ------------------------------------------------------------------------ r1787133 | jleroux | 2017-03-16 08:16:40 +0100 (jeu. 16 mars 2017) | 10 lignes Fixed: While re-ordering an order, order terms doesn't set (OFBIZ-9252) Place an order and click on create as new order button on order detail page. All the information is properly copied over to that order but order terms are not copied to newly created order. Order Terms should be copied while creating cart object. Thanks: Suraj Khurana ------------------------------------------------------------------------ Modified: ofbiz/branches/release16.11/ (props changed) ofbiz/branches/release16.11/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/ShoppingCartServices.java Propchange: ofbiz/branches/release16.11/ ------------------------------------------------------------------------------ --- svn:mergeinfo (original) +++ svn:mergeinfo Thu Mar 16 07:17:40 2017 @@ -10,5 +10,5 @@ /ofbiz/branches/json-integration-refactoring:1634077-1635900 /ofbiz/branches/multitenant20100310:921280-927264 /ofbiz/branches/release13.07:1547657 -/ofbiz/ofbiz-framework/trunk:1783202,1783388,1784549,1784558,1784708,1785882,1785925,1786079,1786214,1786525,1787047 +/ofbiz/ofbiz-framework/trunk:1783202,1783388,1784549,1784558,1784708,1785882,1785925,1786079,1786214,1786525,1787047,1787133 /ofbiz/trunk:1770481,1770490,1770540,1771440,1771448,1771516,1771935,1772346,1772880,1774772,1775441,1779724,1780659,1781109,1781125,1781979,1782498,1782520 Modified: ofbiz/branches/release16.11/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/ShoppingCartServices.java URL: http://svn.apache.org/viewvc/ofbiz/branches/release16.11/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/ShoppingCartServices.java?rev=1787134&r1=1787133&r2=1787134&view=diff ============================================================================== --- ofbiz/branches/release16.11/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/ShoppingCartServices.java (original) +++ ofbiz/branches/release16.11/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/ShoppingCartServices.java Thu Mar 16 07:17:40 2017 @@ -167,6 +167,7 @@ public class ShoppingCartServices { Locale locale = (Locale) context.get("locale"); //FIXME: deepak:Personally I don't like the idea of passing flag but for orderItem quantity calculation we need this flag. String createAsNewOrder = (String) context.get("createAsNewOrder"); + List<GenericValue>orderTerms = null; if (UtilValidate.isEmpty(skipInventoryChecks)) { skipInventoryChecks = Boolean.FALSE; @@ -179,6 +180,7 @@ public class ShoppingCartServices { GenericValue orderHeader = null; try { orderHeader = EntityQuery.use(delegator).from("OrderHeader").where("orderId", orderId).queryOne(); + orderTerms = orderHeader.getRelated("OrderTerm", null, null, false); } catch (GenericEntityException e) { Debug.logError(e, module); return ServiceUtil.returnError(e.getMessage()); @@ -304,6 +306,21 @@ public class ShoppingCartServices { } else { Debug.logInfo("No payment preferences found for order #" + orderId, module); } + // set the order term + if (UtilValidate.isNotEmpty(orderTerms)) { + for (GenericValue orderTerm : orderTerms) { + BigDecimal termValue = BigDecimal.ZERO; + if (UtilValidate.isNotEmpty(orderTerm.getString("termValue"))){ + termValue = new BigDecimal(orderTerm.getString("termValue")); + } + long termDays = 0; + if (UtilValidate.isNotEmpty(orderTerm.getString("termDays"))) { + termDays = Long.parseLong(orderTerm.getString("termDays").trim()); + } + String orderItemSeqId = orderTerm.getString("orderItemSeqId"); + cart.addOrderTerm(orderTerm.getString("termTypeId"), orderItemSeqId, termValue, termDays, orderTerm.getString("textValue"), orderTerm.getString("description")); + } + } List<GenericValue> orderItemShipGroupList = orh.getOrderItemShipGroups(); for (GenericValue orderItemShipGroup: orderItemShipGroupList) { |
Free forum by Nabble | Edit this page |