This is an automated email from the ASF dual-hosted git repository.
arunpati pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/ofbiz-framework.git
The following commit(s) were added to refs/heads/trunk by this push:
new 84ca53d993 Fixed: Canceling an item from the order view and refreshing
the page caused promotional items to endlessly duplicate in the ITEM_CREATED
status. (#1142)
84ca53d993 is described below
commit 84ca53d9931b802479a120f89527fde86f3672f7
Author: Arun Patidar <[email protected]>
AuthorDate: Tue Apr 28 18:07:11 2026 +0530
Fixed: Canceling an item from the order view and refreshing the page caused
promotional items to endlessly duplicate in the ITEM_CREATED status. (#1142)
Fixed: Canceling an item from the order view and refreshing the page
caused promotional items to endlessly duplicate in the ITEM_CREATED
status. (OFBIZ-12104)
Explanation:
1. The recreateOrderAdjustments service created new promotional items
but failed to link them to their ship groups (OrderItemShipGroupAssoc).
Without this link, the cancellation service could not identify or remove
them during subsequent runs, causing items to accumulate.
2. New promotional items were hardcoded to the ITEM_CREATED status, even
if the parent order was already ORDER_APPROVED.
Thanks to Rashi Dhagat for reporting issue.
---
.../ofbiz/order/order/OrderServicesScript.groovy | 23 ++++++++++++++++++----
1 file changed, 19 insertions(+), 4 deletions(-)
diff --git
a/applications/order/src/main/groovy/org/apache/ofbiz/order/order/OrderServicesScript.groovy
b/applications/order/src/main/groovy/org/apache/ofbiz/order/order/OrderServicesScript.groovy
index c2fd7b665d..d4e755c41b 100644
---
a/applications/order/src/main/groovy/org/apache/ofbiz/order/order/OrderServicesScript.groovy
+++
b/applications/order/src/main/groovy/org/apache/ofbiz/order/order/OrderServicesScript.groovy
@@ -31,7 +31,6 @@ import org.apache.ofbiz.order.shoppingcart.ShoppingCart
import org.apache.ofbiz.order.shoppingcart.ShoppingCartItem
import java.sql.Timestamp
-
/**
* Service to create OrderHeader
*/
@@ -214,21 +213,37 @@ Map recreateOrderAdjustments() {
// a new order item is created
GenericValue newOrderItem = makeValue('OrderItem')
newOrderItem.with {
- orderId = parameters.orderId
+ orderId = order.get("orderId")
orderItemTypeId = item.getItemType()
selectedAmount = item.getSelectedAmount()
unitPrice = item.getBasePrice()
unitListPrice = item.getListPrice()
- itemDescription = item.getName(dispatcher)
+ itemDescription = item.getDescription()
statusId = item.getStatusId()
productId = item.getProductId()
quantity = item.getQuantity()
isModifiedPrice = 'N'
isPromo = 'Y'
- statusId = newOrderItem.statusId ?: 'ITEM_CREATED'
+ statusId = order.statusId == 'ORDER_APPROVED' ?
'ITEM_APPROVED' : 'ITEM_CREATED'
}
newOrderItem.orderItemSeqId = delegator.getNextSeqId('OrderItem')
newOrderItem.create()
+
+ // create the OrderItemShipGroupAssoc
+ int itemIndex = cart.getItemIndex(item)
+ int shipGroupIndex = cart.getItemShipGroupIndex(itemIndex)
+ def csi = cart.getShipInfo(shipGroupIndex)
+ String shipGroupSeqId = csi.getShipGroupSeqId()
+
+ GenericValue newOisga = makeValue('OrderItemShipGroupAssoc')
+ newOisga.with {
+ orderId = order.orderId
+ orderItemSeqId = newOrderItem.orderItemSeqId
+ shipGroupSeqId = shipGroupSeqId
+ quantity = newOrderItem.quantity
+ }
+ newOisga.create()
+
// And the orderItemSeqId is assigned to the shopping cart item
item.setOrderItemSeqId(newOrderItem.orderItemSeqId)
}