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 e4f16ded75 Fixed: Regressions in ShoppingListServicesScript.groovy 
introduced by the mini-lang conversion (OFBIZ-13662)
e4f16ded75 is described below

commit e4f16ded75756edc0cf0cfd753e688c1b8880155
Author: Mridul Pathak <[email protected]>
AuthorDate: Fri Oct 9 11:56:39 2026 +0530

    Fixed: Regressions in ShoppingListServicesScript.groovy introduced by the 
mini-lang conversion (OFBIZ-13662)
    
    The Groovy conversion of ShoppingListServices.xml changed the behaviour of 
two services. Restore the mini-lang behaviour:
    
    - addSuggestionsToShoppingList: for a variant product, link the complements 
of the virtual product (productId of the variant ProductAssoc) instead of 
re-linking the complements of the variant itself
    - createShoppingListItem: treat a missing quantity as zero when adding to 
an existing shopping list item
    
    (cherry picked from commit a0fe9ac86e0aab2364441ef9ebd4e990070f0b2a)
---
 .../apache/ofbiz/order/shoppinglist/ShoppingListServicesScript.groovy | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git 
a/applications/order/src/main/groovy/org/apache/ofbiz/order/shoppinglist/ShoppingListServicesScript.groovy
 
b/applications/order/src/main/groovy/org/apache/ofbiz/order/shoppinglist/ShoppingListServicesScript.groovy
index 8979bce9e6..adc83163b2 100644
--- 
a/applications/order/src/main/groovy/org/apache/ofbiz/order/shoppinglist/ShoppingListServicesScript.groovy
+++ 
b/applications/order/src/main/groovy/org/apache/ofbiz/order/shoppinglist/ShoppingListServicesScript.groovy
@@ -87,7 +87,7 @@ Map createShoppingListItem() {
                     .queryList()
             if ((!slItemAttributes && !parameters.shoppingListItemAttributes) 
||
                     Objects.equals(slItemAttributes, 
parameters.shoppingListItemAttributes)) {
-                BigDecimal totalquantity = shoppingListItem.quantity + 
parameters.quantity
+                BigDecimal totalquantity = (shoppingListItem.quantity ?: 
BigDecimal.ZERO) + (parameters.quantity ?: BigDecimal.ZERO)
                 result.shoppingListItemSeqId = 
shoppingListItem.shoppingListItemSeqId
                 Map serviceResult = run service: 'updateShoppingListItem', 
with: [*: shoppingListItem, quantity: totalquantity]
                 if (!ServiceUtil.isSuccess(serviceResult)) {
@@ -299,7 +299,7 @@ Map addSuggestionsToShoppingList() {
                         .filterByDate()
                         .queryFirst()
                 if (virtualProductAssoc) {
-                    linkProductToShoppingList(virtualProductAssoc.productIdTo, 
shoppingListId)
+                    linkProductToShoppingList(virtualProductAssoc.productId, 
shoppingListId)
                 }
             }
         }

Reply via email to