This is an automated email from the ASF dual-hosted git repository.

jleroux 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 1d09747d2a Fixed: Outdated method call in 
ShoppingListServicesScript.groovy (#726)
1d09747d2a is described below

commit 1d09747d2a2c4d3038b01c109fd091e33d0eb361
Author: cshan-ecomify <117295991+cshan-ecom...@users.noreply.github.com>
AuthorDate: Thu Mar 14 15:52:01 2024 +0100

    Fixed: Outdated method call in ShoppingListServicesScript.groovy (#726)
    
    (OFBIZ-12939)
---
 .../shoppinglist/ShoppingListServicesScript.groovy   | 20 +++++++++-----------
 1 file changed, 9 insertions(+), 11 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 a92f10f240..c1f67e116f 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
@@ -71,7 +71,6 @@ Map updateShoppingList() {
 
 /**
  * Create a ShoppingList Item
- * @return
  */
 Map createShoppingListItem() {
     Map result = success()
@@ -87,16 +86,15 @@ Map createShoppingListItem() {
                     .where('shoppingListId', parameters.shoppingListId, 
'shoppingListItemSeqId', shoppingListItem.shoppingListItemSeqId)
                     .queryList()
             if ((!slItemAttributes && !parameters.shoppingListItemAttributes) 
||
-                UtilValidate.areEqual(slItemAttributes, 
parameters.shoppingListItemAttributes)) {
-                    BigDecimal totalquantity = shoppingListItem.quantity + 
parameters.quantity
-                    result.shoppingListItemSeqId = 
shoppingListItem.shoppingListItemSeqId
-                    Map serviceResult = run service: 'updateShoppingListItem', 
with: [*       : shoppingListItem,
-                        quantity: totalquantity]
-                    if (!ServiceUtil.isSuccess(serviceResult)) {
-                        return error(serviceResult.errorMessage)
-                    }
-                    // Exit here, because we found an existing item update, 
otherwise we have to create a new one below
-                    return result
+                    Objects.equals(slItemAttributes, 
parameters.shoppingListItemAttributes)) {
+                BigDecimal totalquantity = shoppingListItem.quantity + 
parameters.quantity
+                result.shoppingListItemSeqId = 
shoppingListItem.shoppingListItemSeqId
+                Map serviceResult = run service: 'updateShoppingListItem', 
with: [*: shoppingListItem, quantity: totalquantity]
+                if (!ServiceUtil.isSuccess(serviceResult)) {
+                    return error(serviceResult.errorMessage)
+                }
+                // Exit here, because we found an existing item update, 
otherwise we have to create a new one below
+                return result
             }
         }
     }

Reply via email to