Skip to content

Commit 7c6d508

Browse files
committed
Fixed: Canceling an item from the order view and refreshing the page caused
promotional items to endlessly duplicate in the ITEM_CREATED status. (apache#1142) Fixes 4 Codenarc issues
1 parent 84ca53d commit 7c6d508

1 file changed

Lines changed: 7 additions & 5 deletions

File tree

applications/order/src/main/groovy/org/apache/ofbiz/order/order/OrderServicesScript.groovy

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818
*/
1919
package org.apache.ofbiz.order.order
2020

21+
import java.sql.Timestamp
22+
2123
import org.apache.ofbiz.base.util.GeneralException
2224
import org.apache.ofbiz.base.util.ObjectType
2325
import org.apache.ofbiz.base.util.UtilDateTime
@@ -28,9 +30,9 @@ import org.apache.ofbiz.entity.condition.EntityConditionBuilder
2830
import org.apache.ofbiz.entity.condition.EntityOperator
2931
import org.apache.ofbiz.order.customer.CheckoutMapProcs
3032
import org.apache.ofbiz.order.shoppingcart.ShoppingCart
33+
import org.apache.ofbiz.order.shoppingcart.ShoppingCart.CartShipInfo
3134
import org.apache.ofbiz.order.shoppingcart.ShoppingCartItem
3235

33-
import java.sql.Timestamp
3436
/**
3537
* Service to create OrderHeader
3638
*/
@@ -213,7 +215,7 @@ Map recreateOrderAdjustments() {
213215
// a new order item is created
214216
GenericValue newOrderItem = makeValue('OrderItem')
215217
newOrderItem.with {
216-
orderId = order.get("orderId")
218+
orderId = order.get('orderId')
217219
orderItemTypeId = item.getItemType()
218220
selectedAmount = item.getSelectedAmount()
219221
unitPrice = item.getBasePrice()
@@ -232,14 +234,14 @@ Map recreateOrderAdjustments() {
232234
// create the OrderItemShipGroupAssoc
233235
int itemIndex = cart.getItemIndex(item)
234236
int shipGroupIndex = cart.getItemShipGroupIndex(itemIndex)
235-
def csi = cart.getShipInfo(shipGroupIndex)
236-
String shipGroupSeqId = csi.getShipGroupSeqId()
237+
CartShipInfo csi = cart.getShipInfo(shipGroupIndex)
238+
String shipGroupSeqIdExt = csi.getShipGroupSeqId()
237239

238240
GenericValue newOisga = makeValue('OrderItemShipGroupAssoc')
239241
newOisga.with {
240242
orderId = order.orderId
241243
orderItemSeqId = newOrderItem.orderItemSeqId
242-
shipGroupSeqId = shipGroupSeqId
244+
shipGroupSeqId = shipGroupSeqIdExt
243245
quantity = newOrderItem.quantity
244246
}
245247
newOisga.create()

0 commit comments

Comments
 (0)