You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by mr...@apache.org on 2026/09/27 09:01:43 UTC

(ofbiz-framework) branch release24.09 updated: Fixed: Regressions in the minilang-to-Groovy conversion of OrderReturnServicesScript.groovy (OFBIZ-13619)

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 54fb288e70 Fixed: Regressions in the minilang-to-Groovy conversion of OrderReturnServicesScript.groovy (OFBIZ-13619)
54fb288e70 is described below

commit 54fb288e70763067db0bab759927f9e0628c9980
Author: Mridul Pathak <mr...@gmail.com>
AuthorDate: Sun Sep 27 14:18:40 2026 +0530

    Fixed: Regressions in the minilang-to-Groovy conversion of OrderReturnServicesScript.groovy (OFBIZ-13619)
    
    - quickReturnFromOrder() read availableReturnTotal from a stale service-result variable that never had that field, always null; also fixed the adjacent countNewReturnItems key typo (was countNewReturnItemx, silently ignored) and a broken log interpolation, all in the same statement block.
    - createExchangeOrderAssoc() called makeValue('OrderItemAsscoc'), a nonexistent entity name, guaranteed to throw whenever this branch is taken.
    - updateReturnContactMech() never deleted the prior ReturnContactMech row when the contact mech changed, since contactMechId is part of its primary key; restored the missing deleteReturnContactMech call using oldContactMechId.
    - updateReturnItem() set ctx.ReturnTypeId (capital R) instead of ctx.returnTypeId when calling updateReturnAdjustment, so the return type was never actually passed through.
---
 .../ofbiz/order/order/OrderReturnServicesScript.groovy    | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/applications/order/src/main/groovy/org/apache/ofbiz/order/order/OrderReturnServicesScript.groovy b/applications/order/src/main/groovy/org/apache/ofbiz/order/order/OrderReturnServicesScript.groovy
index bff11c20b9..5f79c043a3 100644
--- a/applications/order/src/main/groovy/org/apache/ofbiz/order/order/OrderReturnServicesScript.groovy
+++ b/applications/order/src/main/groovy/org/apache/ofbiz/order/order/OrderReturnServicesScript.groovy
@@ -298,7 +298,7 @@ Map updateReturnItem() {
         ctx << returnAdjustment
         ctx.originalReturnPrice = originalReturnPrice
         ctx.originalReturnQuantity = originalReturnQuantity
-        ctx.ReturnTypeId = returnItem.returnTypeId
+        ctx.returnTypeId = returnItem.returnTypeId
         run service: 'updateReturnAdjustment', with: ctx
     }
     return result
@@ -528,14 +528,14 @@ Map quickReturnFromOrder() {
             run service: 'createReturnAdjustment', with: returnAdjCtx
         }
     }
-    // very important: if countNewReturnItemx is not set,
+    // very important: if countNewReturnItems is not set,
     // getOrderAvailableReturnedTotal would not count the return items we just created
-    Map orderAvailableCtx = [orderId: orderHeader.orderId, countNewReturnItemx: true]
+    Map orderAvailableCtx = [orderId: orderHeader.orderId, countNewReturnItems: true]
     Map serviceResultART = run service: 'getOrderAvailableReturnedTotal', with: orderAvailableCtx
-    BigDecimal availableReturnTotal = serviceResult.availableReturnTotal
+    BigDecimal availableReturnTotal = serviceResultART.availableReturnTotal
     BigDecimal returnTotal = serviceResultART.returnTotal
     BigDecimal orderTotal = serviceResultART.orderTotal
-    logInfo("OrderTotal [${orderTotal}] - ReturnTotal [${returnTotal}] = available Return Total [${}]")
+    logInfo("OrderTotal [${orderTotal}] - ReturnTotal [${returnTotal}] = available Return Total [${availableReturnTotal}]")
 
     // create a manual balance adjustment based on the difference between order total and return total
     if (availableReturnTotal != (BigDecimal.ZERO)) {
@@ -781,7 +781,7 @@ Map createExchangeOrderAssoc() {
             orderItemAssocMap.shipGroupSeqId = '_NA_'
             orderItemAssocMap.toShipGroupSeqId = '_NA_'
             orderItemAssocMap.orderItemAssocTypeId = 'EXCHANGE'
-            GenericValue orderItemAssoc = makeValue('OrderItemAsscoc')
+            GenericValue orderItemAssoc = makeValue('OrderItemAssoc')
             orderItemAssoc.setPKFields(orderItemAssocMap)
             GenericValue orderItemAssocValue = from('OrderItemAssoc').where(orderItemAssoc).queryOne()
             if (!orderItemAssocValue) {
@@ -886,6 +886,9 @@ Map updateReturnContactMech() {
             returnHeader.store()
         }
         run service: 'createReturnContactMech', with: createReturnContactMechMap
+        run service: 'deleteReturnContactMech', with: [returnId: parameters.returnId,
+                                                       contactMechId: parameters.oldContactMechId,
+                                                       contactMechPurposeTypeId: parameters.contactMechPurposeTypeId]
     }
     returnContactMechMap.store()
     return success()