Skip to content

Commit ee3a762

Browse files
authored
Fixed issue in reCreateOrderAdjustment service on adding promo item after cancel order item request. (#1137)
Fixed: After cancelling it was creating only orderItem record while we need to map that item with orderItemShipGroup using ship group assocs. So added support to create ship group assoc whenever it creats new item due to promotion.[OFBIZ-12104] (OFBIZ-12104) Thanks: Rashi Dhagat for reporting the issue and providing details.
1 parent 86c6f3a commit ee3a762

1 file changed

Lines changed: 26 additions & 1 deletion

File tree

applications/order/minilang/order/OrderServices.xml

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -384,10 +384,35 @@ under the License.
384384
<set field="newOrderItem.isModifiedPrice" value="N"/>
385385
<set field="newOrderItem.isPromo" value="Y"/>
386386
<if-empty field="newOrderItem.statusId">
387-
<set field="newOrderItem.statusId" value="ITEM_CREATED"/>
387+
<if-compare field="order.statusId" operator="equals" value="ORDER_APPROVED">
388+
<set field="newOrderItem.statusId" value="ITEM_APPROVED"/>
389+
<else>
390+
<set field="newOrderItem.statusId" value="ITEM_CREATED"/>
391+
</else>
392+
</if-compare>
388393
</if-empty>
389394
<make-next-seq-id value-field="newOrderItem" seq-field-name="orderItemSeqId"/>
390395
<create-value value-field="newOrderItem"/>
396+
397+
<!-- create the OrderItemShipGroupAssoc -->
398+
<call-object-method obj-field="cart" method-name="getItemIndex" ret-field="itemIndex">
399+
<field field="item" type="org.apache.ofbiz.order.shoppingcart.ShoppingCartItem"/>
400+
</call-object-method>
401+
<call-object-method obj-field="cart" method-name="getItemShipGroupIndex" ret-field="shipGroupIndex">
402+
<field field="itemIndex" type="int"/>
403+
</call-object-method>
404+
<call-object-method obj-field="cart" method-name="getShipInfo" ret-field="csi">
405+
<field field="shipGroupIndex" type="int"/>
406+
</call-object-method>
407+
<call-object-method obj-field="csi" method-name="getShipGroupSeqId" ret-field="shipGroupSeqId"/>
408+
409+
<make-value entity-name="OrderItemShipGroupAssoc" value-field="newOisga"/>
410+
<set field="newOisga.orderId" from-field="parameters.orderId"/>
411+
<set field="newOisga.orderItemSeqId" from-field="newOrderItem.orderItemSeqId"/>
412+
<set field="newOisga.shipGroupSeqId" from-field="shipGroupSeqId"/>
413+
<set field="newOisga.quantity" from-field="newOrderItem.quantity"/>
414+
<create-value value-field="newOisga"/>
415+
391416
<!-- and the orderItemSeqId is assigned to the shopping cart item-->
392417
<call-object-method obj-field="item" method-name="setOrderItemSeqId">
393418
<field field="newOrderItem.orderItemSeqId" type="String"/>

0 commit comments

Comments
 (0)