This is an automated email from the ASF dual-hosted git repository.
mridulpathak pushed a commit to branch release24.09
in repository https://gitbox.apache.org/repos/asf/ofbiz-framework.git
The following commit(s) were added to refs/heads/release24.09 by this push:
new 056df1c4b2 Fixed: createQuoteFromCart duplicates QuoteAdjustment
records (OFBIZ-13525)
056df1c4b2 is described below
commit 056df1c4b2e9a935f1c4a7a6a287c8370ad80117
Author: Mridul Pathak <[email protected]>
AuthorDate: Tue Sep 8 20:34:18 2026 +0530
Fixed: createQuoteFromCart duplicates QuoteAdjustment records (OFBIZ-13525)
The block that creates QuoteAdjustment records from the cart's store
promotions was nested inside the per-cart-item loop instead of running
once after it. Every store promotion recomputed by makeAllQuoteAdjustments()
covers the whole cart, not a single item, so nesting it inside the loop
persisted the same set of adjustments once per cart item instead of once
per order, inflating quote totals for any cart with more than one item.
Moving the block outside the loop restores the original minilang's
once-per-cart behavior.
---
.../org/apache/ofbiz/order/quote/QuoteServicesScript.groovy | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git
a/applications/order/src/main/groovy/org/apache/ofbiz/order/quote/QuoteServicesScript.groovy
b/applications/order/src/main/groovy/org/apache/ofbiz/order/quote/QuoteServicesScript.groovy
index 6e6f575093..7cb8e62124 100644
---
a/applications/order/src/main/groovy/org/apache/ofbiz/order/quote/QuoteServicesScript.groovy
+++
b/applications/order/src/main/groovy/org/apache/ofbiz/order/quote/QuoteServicesScript.groovy
@@ -526,12 +526,12 @@ Map createQuoteFromCart() {
//and the quoteItemSeqId is assigned to the shopping cart item (as
orderItemSeqId)
item.setOrderItemSeqId(serviceQuoteItemResult.quoteItemSeqId)
}
- if (parameters.applyStorePromotions != 'N') {
- cart.makeAllQuoteAdjustments()?.each { GenericValue adjustment ->
- adjustment.quoteId = quote.quoteId
- adjustment.quoteAdjustmentId =
delegator.getNextSeqId('QuoteAdjustment')
- adjustment.create()
- }
+ }
+ if (parameters.applyStorePromotions != 'N') {
+ cart.makeAllQuoteAdjustments()?.each { GenericValue adjustment ->
+ adjustment.quoteId = quote.quoteId
+ adjustment.quoteAdjustmentId =
delegator.getNextSeqId('QuoteAdjustment')
+ adjustment.create()
}
}
return [successMessage: null, quoteId: quote.quoteId]