This is an automated email from the ASF dual-hosted git repository.
mridulpathak 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 e9c3244ad7 Fixed: createQuoteFromCart duplicates QuoteAdjustment
records (OFBIZ-13525)
e9c3244ad7 is described below
commit e9c3244ad7c6e237e924a64c60ab54a25a7cbb6b
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 017820d9b6..1989aaad7d 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]