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 f54c158744 Fixed: Regressions in QuoteServicesScript.groovy introduced
by the mini-lang conversion (OFBIZ-13660)
f54c158744 is described below
commit f54c1587444d75104b322fbe9d5452455488c964
Author: Mridul Pathak <[email protected]>
AuthorDate: Thu Oct 8 18:14:12 2026 +0530
Fixed: Regressions in QuoteServicesScript.groovy introduced by the
mini-lang conversion (OFBIZ-13660)
The Groovy conversion of QuoteServices.xml changed the behaviour of several
services. Restore the mini-lang behaviour:
- copyQuote: copy each quote item with the copyQuoteItem service so that
the item level adjustments are copied too
- createQuoteAndQuoteItemForRequest: build the quote from the request
fields the mini-lang used instead of spreading the whole CustRequest, which
leaked its CRQ_ status into the quote, let the submitted quote item fields take
precedence over the request item, and skip a quote role that createQuote
already created
- createQuoteItem and autoUpdateQuotePrice: treat a price of zero as a
value instead of as missing
- copyQuote (release24.09 only): fix the misspelled loop variable
quoteAdjustement, which made the adjustment copy throw whenever the quote had
adjustments
(cherry picked from commit bdc5f603012357d1ebe1c6b1349da7b142911583)
---
.../ofbiz/order/quote/QuoteServicesScript.groovy | 38 ++++++++++++++--------
1 file changed, 24 insertions(+), 14 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 4df0e1ac7c..0d3dfb293f 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
@@ -219,9 +219,10 @@ Map copyQuote() {
if (parameters.copyQuoteItems == 'Y') {
List quoteItems = quote.getRelated('QuoteItem', null, null, false)
for (GenericValue quoteItem : quoteItems) {
- Map serviceContext = dctx.makeValidContext('createQuoteItem',
ModelService.IN_PARAM,
- [*: quoteItem, quoteId: quoteIdTo, userLogin: userLogin])
- serviceResult = dispatcher.runSync('createQuoteItem',
serviceContext)
+ Map serviceContext = dctx.makeValidContext('copyQuoteItem',
ModelService.IN_PARAM,
+ [quoteId: quoteItem.quoteId, quoteItemSeqId:
quoteItem.quoteItemSeqId, quoteIdTo: quoteIdTo,
+ copyQuoteAdjustments: parameters.copyQuoteAdjustments,
userLogin: userLogin])
+ serviceResult = dispatcher.runSync('copyQuoteItem', serviceContext)
if (ServiceUtil.isError(serviceResult)) {
return serviceResult
}
@@ -231,10 +232,10 @@ Map copyQuote() {
// Copy quoteAdjustments.
if (parameters.copyQuoteAdjustments == 'Y') {
List quoteAdjustments = quote.getRelated('QuoteAdjustment', null,
null, false)
- for (GenericValue quoteAdjustement : quoteAdjustments) {
+ for (GenericValue quoteAdjustment : quoteAdjustments) {
if (!quoteAdjustment.quoteItemSeqId) {
Map serviceContext =
dctx.makeValidContext('createQuoteAdjustment', ModelService.IN_PARAM,
- [*: quoteAdjustement, quoteId: quoteIdTo, userLogin:
userLogin])
+ [*: quoteAdjustment, quoteId: quoteIdTo, userLogin:
userLogin])
serviceResult = dispatcher.runSync('createQuoteAdjustment',
serviceContext)
if (ServiceUtil.isError(serviceResult)) {
return serviceResult
@@ -342,7 +343,7 @@ Map createQuoteItem() {
delegator.setNextSubSeqId(quoteItem, 'quoteItemSeqId', 5, 1)
}
- if (!parameters.quoteUnitPrice && parameters.productId) {
+ if (parameters.quoteUnitPrice == null && parameters.productId) {
GenericValue product = from('Product').where('productId',
parameters.productId).cache().queryOne()
if (product?.isVirtual == 'Y') {
return error(UtilProperties.getMessage('OrderErrorUiLabels',
'OrderCannotAddVirtualProductToQuote', locale))
@@ -459,27 +460,36 @@ Map createQuoteAndQuoteItemForRequest() {
Map input = [
userLogin: userLogin,
*: parameters,
- *: custRequest,
quoteTypeId: 'PROPOSAL',
partyId: custRequest.fromPartyId,
quoteName: custRequest.custRequestName,
- currencyUomId: custRequest.maximumAmountUomId
+ description: custRequest.description,
+ currencyUomId: custRequest.maximumAmountUomId,
+ productStoreId: custRequest.productStoreId,
+ salesChannelEnumId: custRequest.salesChannelEnumId
]
input.statusId = input.statusId ?: 'QUO_CREATED'
Map serviceResult = run service: 'createQuote', with: input
String quoteId = serviceResult.quoteId
+ // the quote item fields submitted by the caller take precedence over the
ones of the request item
serviceResult = run service: 'createQuoteItem', with: [
- *: custRequestItem,
- comments: custRequestItem.story,
+ *: (custRequestItem ?: [:]),
+ *: parameters.findAll { key, value -> value != null },
+ comments: custRequestItem?.story ?: parameters.comments,
quoteId: quoteId
]
String quoteItemSeqId = serviceResult.quoteItemSeqId
- // copy the roles from the request to the quote
+ // copy the roles from the request to the quote, createQuote may already
have added the request taker
List custRequestParties = from('CustRequestParty').where(custRequestId:
custRequest.custRequestId).queryList()
custRequestParties?.each { GenericValue custPartyRole ->
- serviceResult = run service: 'createQuoteRole', with: [*:
custPartyRole, quoteId: quoteId]
+ GenericValue existingQuoteRole = from('QuoteRole')
+ .where(quoteId: quoteId, partyId: custPartyRole.partyId,
roleTypeId: custPartyRole.roleTypeId)
+ .queryOne()
+ if (!existingQuoteRole) {
+ serviceResult = run service: 'createQuoteRole', with: [*:
custPartyRole, quoteId: quoteId]
+ }
}
return [successMessage: null, quoteId: quoteId, quoteItemSeqId:
quoteItemSeqId]
@@ -577,9 +587,9 @@ Map autoUpdateQuotePrice() {
if (!quoteItem) {
return error(UtilProperties.getMessage('OrderErrorUiLabels',
'OrderQuoteItemDoesNotExists', locale))
}
- if (parameters.manualQuoteUnitPrice) {
+ if (parameters.manualQuoteUnitPrice != null) {
quoteItem.quoteUnitPrice = parameters.manualQuoteUnitPrice
- } else if (parameters.defaultQuoteUnitPrice) {
+ } else if (parameters.defaultQuoteUnitPrice != null) {
quoteItem.quoteUnitPrice = parameters.defaultQuoteUnitPrice
}
quoteItem.store()