Author: lektran
Date: Sun Apr 15 23:00:53 2007 New Revision: 529138 URL: http://svn.apache.org/viewvc?view=rev&rev=529138 Log: A few more fixes related to editing/cancelling orders Modified: ofbiz/trunk/applications/order/script/org/ofbiz/order/order/OrderServices.xml ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderServices.java ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartServices.java ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/orderview.bsh Modified: ofbiz/trunk/applications/order/script/org/ofbiz/order/order/OrderServices.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/script/org/ofbiz/order/order/OrderServices.xml?view=diff&rev=529138&r1=529137&r2=529138 ============================================================================== --- ofbiz/trunk/applications/order/script/org/ofbiz/order/order/OrderServices.xml (original) +++ ofbiz/trunk/applications/order/script/org/ofbiz/order/order/OrderServices.xml Sun Apr 15 23:00:53 2007 @@ -501,12 +501,20 @@ <!-- all existing promo order items are cancelled --> <get-related value-name="order" relation-name="OrderItem" list-name="orderItems"/> <iterate list-name="orderItems" entry-name="orderItem"> - <if-compare field-name="orderItem.isPromo" value="Y" operator="equals"> - <clear-field field-name="cancelOrderItemInMap"/> - <set-service-fields service-name="cancelOrderItemNoActions" to-map-name="cancelOrderItemInMap" map-name="parameters"/> - <set from-field="orderItem.orderItemSeqId" field="cancelOrderItemInMap.orderItemSeqId"/> - <call-service service-name="cancelOrderItemNoActions" in-map-name="cancelOrderItemInMap"/> - </if-compare> + <if> + <condition> + <and> + <if-compare field-name="orderItem.isPromo" value="Y" operator="equals"/> + <if-compare field-name="orderItem.statusId" value="ITEM_CANCELLED" operator="not-equals"/> + </and> + </condition> + <then> + <clear-field field-name="cancelOrderItemInMap"/> + <set-service-fields service-name="cancelOrderItemNoActions" to-map-name="cancelOrderItemInMap" map-name="parameters"/> + <set from-field="orderItem.orderItemSeqId" field="cancelOrderItemInMap.orderItemSeqId"/> + <call-service service-name="cancelOrderItemNoActions" in-map-name="cancelOrderItemInMap"/> + </then> + </if> </iterate> <get-related value-name="order" relation-name="OrderAdjustment" list-name="orderAdjustments"/> @@ -516,9 +524,7 @@ <iterate list-name="orderAdjustments" entry-name="orderAdjustment"> <if> <condition> - <and> - <not><if-empty field-name="orderAdjustment.productPromoId"/></not> - </and> + <not><if-empty field-name="orderAdjustment.productPromoId"/></not> </condition> <then> <calculate field-name="existingOrderAdjustmentTotal" decimal-scale="3"> @@ -565,7 +571,6 @@ <call-object-method obj-field-name="item" method-name="setOrderItemSeqId"> <field field-name="newOrderItem.orderItemSeqId" type="String"/> </call-object-method> - <call-object-method obj-field-name="item" method-name="getOrderItemSeqId" ret-field-name="newOrderItemSeqId"/> </if-empty> </iterate> <call-object-method obj-field-name="cart" method-name="makeAllAdjustments" ret-field-name="adjustments"/> @@ -573,12 +578,19 @@ <!-- Accumulate the new promotion total from the recalculated promotion adjustments --> <set field="newOrderAdjustmentTotal" value="0" type="BigDecimal"/> <iterate list-name="adjustments" entry-name="adjustment"> - <calculate field-name="newOrderAdjustmentTotal" decimal-scale="3"> - <calcop operator="add"> - <calcop operator="get" field-name="adjustment.amount"/> - <calcop operator="get" field-name="newOrderAdjustmentTotal"/> - </calcop> - </calculate> + <if> + <condition> + <not><if-empty field-name="orderAdjustment.productPromoId"/></not> + </condition> + <then> + <calculate field-name="newOrderAdjustmentTotal" decimal-scale="3"> + <calcop operator="add"> + <calcop operator="get" field-name="adjustment.amount"/> + <calcop operator="get" field-name="newOrderAdjustmentTotal"/> + </calcop> + </calculate> + </then> + </if> </iterate> <!-- Determine the difference between existing and new promotion adjustment totals, if any --> @@ -594,13 +606,11 @@ <set field="createOrderAdjContext.orderId" from-field="parameters.orderId"/> <set field="createOrderAdjContext.orderItemSeqId" value="_NA_"/> <set field="createOrderAdjContext.shipGroupSeqId" value="_NA_"/> - <set field="createOrderAdjContext.orderId" from-field="parameters.orderId"/> <set field="createOrderAdjContext.description" value="Adjustment due to order change"/> <set field="createOrderAdjContext.amount" from-field="orderAdjustmentTotalDifference" type="Double"/> <call-service service-name="createOrderAdjustment" in-map-name="createOrderAdjContext" include-user-login="true"/> <check-errors/> </if-compare> - </simple-method> <!--UpdateOrderContactMech--> Modified: ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderServices.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderServices.java?view=diff&rev=529138&r1=529137&r2=529138 ============================================================================== --- ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderServices.java (original) +++ ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderServices.java Sun Apr 15 23:00:53 2007 @@ -3278,6 +3278,10 @@ Iterator pii = promoItems.iterator(); while (pii.hasNext()) { GenericValue promoItem = (GenericValue) pii.next(); + // Skip if the promo is already cancelled + if ("ITEM_CANCELLED".equals(promoItem.get("statusId"))) { + continue; + } Map cancelPromoCtx = UtilMisc.toMap("orderId", orderId); cancelPromoCtx.put("orderItemSeqId", promoItem.getString("orderItemSeqId")); cancelPromoCtx.put("userLogin", userLogin); Modified: ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartServices.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartServices.java?view=diff&rev=529138&r1=529137&r2=529138 ============================================================================== --- ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartServices.java (original) +++ ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartServices.java Sun Apr 15 23:00:53 2007 @@ -251,7 +251,7 @@ Debug.log("No payment preferences found for order #" + orderId, module); } - List orderItems = orh.getOrderItems(); + List orderItems = orh.getValidOrderItems(); long nextItemSeq = 0; if (orderItems != null) { Iterator i = orderItems.iterator(); Modified: ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/orderview.bsh URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/orderview.bsh?view=diff&rev=529138&r1=529137&r2=529138 ============================================================================== --- ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/orderview.bsh (original) +++ ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/orderview.bsh Sun Apr 15 23:00:53 2007 @@ -58,7 +58,7 @@ context.put("canViewInternalDetails", true); orderReadHelper = new OrderReadHelper(orderHeader); - orderItems = orderReadHelper.getValidOrderItems(); + orderItems = orderReadHelper.getOrderItems(); orderAdjustments = orderReadHelper.getAdjustments(); orderHeaderAdjustments = orderReadHelper.getOrderHeaderAdjustments(); orderSubTotal = orderReadHelper.getOrderItemsSubTotal(); |
Free forum by Nabble | Edit this page |