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 f6d5ed56ea Fixed: Two regressions in the minilang-to-Groovy conversion 
of ProductionRunServicesScript.groovy (OFBIZ-13618)
f6d5ed56ea is described below

commit f6d5ed56eac99f3bff9f5cedcea7041fac3c9834
Author: Mridul Pathak <[email protected]>
AuthorDate: Sun Sep 27 14:04:58 2026 +0530

    Fixed: Two regressions in the minilang-to-Groovy conversion of 
ProductionRunServicesScript.groovy (OFBIZ-13618)
    
    Backported from trunk (#2123). Only the two findings that apply to this 
file's pre-manufacturing-reservation-feature shape are included here; the other 
three findings in the trunk PR live in code that was never backported to this 
branch. Manually re-applied (not cherry-picked) since this file's surrounding 
code has diverged too far from trunk for a clean cherry-pick.
    
    - createProductionRunPartyAssign() echoed back the internally-defaulted 
workEffortId instead of the original productionRunId, corrupting the OUT 
parameter when the two differ.
    - issueProductionRunTaskComponent() dereferenced the WorkEffort and its 
parent production run without null-checking either lookup, throwing an NPE 
instead of a clean service error for a missing task or orphaned parent.
---
 .../manufacturing/jobshopmgt/ProductionRunServicesScript.groovy   | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git 
a/applications/manufacturing/src/main/groovy/org/apache/ofbiz/manufacturing/jobshopmgt/ProductionRunServicesScript.groovy
 
b/applications/manufacturing/src/main/groovy/org/apache/ofbiz/manufacturing/jobshopmgt/ProductionRunServicesScript.groovy
index 0423668f81..80e4355eaf 100644
--- 
a/applications/manufacturing/src/main/groovy/org/apache/ofbiz/manufacturing/jobshopmgt/ProductionRunServicesScript.groovy
+++ 
b/applications/manufacturing/src/main/groovy/org/apache/ofbiz/manufacturing/jobshopmgt/ProductionRunServicesScript.groovy
@@ -34,7 +34,7 @@ Map createProductionRunPartyAssign() {
     if (ServiceUtil.isError(serviceResult)) {
         return serviceResult
     }
-    return [successMessage: null, productionRunId: parameters.workEffortId]
+    return [successMessage: null, productionRunId: parameters.productionRunId]
 }
 
 /**
@@ -107,7 +107,13 @@ Map issueProductionRunTask() {
  */
 Map issueProductionRunTaskComponent() {
     GenericValue workEffort = from('WorkEffort').where(workEffortId: 
parameters.workEffortId).queryOne()
+    if (!workEffort) {
+        return ServiceUtil.returnError("Cannot find the production run task 
with id: ${parameters.workEffortId}")
+    }
     GenericValue productionRun = from('WorkEffort').where(workEffortId: 
workEffort.workEffortParentId).queryOne()
+    if (!productionRun) {
+        return ServiceUtil.returnError("Cannot find the production run with 
id: ${workEffort.workEffortParentId}")
+    }
     if (['PRUN_CANCELLED', 
'PRUN_CLOSED'].contains(productionRun.currentStatusId)) {
         return error(label('ManufacturingUiLabels', 
'ManufacturingAddProdCompInCompCanStatusError'))
     }

Reply via email to