You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ofbiz.apache.org by "ASF subversion and git services (Jira)" <ji...@apache.org> on 2026/09/27 08:47:00 UTC
[jira] [Commented] (OFBIZ-13618) Five regressions in ProductionRunServicesScript.groovy
[ https://issues.apache.org/jira/browse/OFBIZ-13618?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18119792#comment-18119792 ]
ASF subversion and git services commented on OFBIZ-13618:
---------------------------------------------------------
Commit 5c44d5ed179759b533a0d08a6872394b6ab7fa5a in ofbiz-framework's branch refs/heads/trunk from Mridul Pathak
[ https://gitbox.apache.org/repos/asf?p=ofbiz-framework.git;h=5c44d5ed17 ]
Fixed: Five regressions in the minilang-to-Groovy conversion of ProductionRunServicesScript.groovy (OFBIZ-13618)
- 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.
- issueProductionRunTaskComponentInline()'s physical-integrity guard netted the caller's own reservation by quantityNotAvailable, making it stricter than the capacity the calling pool-stock loop had already sized issuance to, which could wrongly abort a whole multi-item issuance instead of issuing what fits.
- issueInventoryItemToWorkEffort() capped issuance at quantityOnHandTotal instead of availableToPromiseTotal, letting it issue inventory already promised to other tasks.
- handleManualIssuanceOverride() discarded the result of its inline issuance call, reporting success even when the inline call actually failed.
> Five regressions in ProductionRunServicesScript.groovy
> ------------------------------------------------------
>
> Key: OFBIZ-13618
> URL: https://issues.apache.org/jira/browse/OFBIZ-13618
> Project: OFBiz
> Issue Type: Bug
> Components: manufacturing
> Affects Versions: Upcoming Branch, 24.09.07
> Reporter: Mridul Pathak
> Assignee: Mridul Pathak
> Priority: Major
>
> Three of these five predate OFBIZ-13262 (the May 2026 inventory-reservation feature); two are inside code that feature added.
> h3. 1. {{createProductionRunPartyAssign()}} returns the wrong ID
> {code:java}
> return [successMessage: null, productionRunId: parameters.workEffortId]
> {code}
> Mini-lang always returned the caller's original {{parameters.productionRunId}}. The Groovy version returns {{parameters.workEffortId}} (post-defaulting), so when a caller assigns a party to a specific *task* (a distinct {{workEffortId}} under the production run), the returned {{productionRunId}} is silently overwritten with the task's ID instead of the real production run's.
> h3. 2. {{issueProductionRunTaskComponent()}} NPEs on a missing WorkEffort
> {code:java}
> GenericValue workEffort = from('WorkEffort').where(workEffortId: parameters.workEffortId).queryOne()
> GenericValue productionRun = from('WorkEffort').where(workEffortId: workEffort.workEffortParentId).queryOne()
> {code}
> No null-check on either lookup; mini-lang's equivalent entity/if-compare tags degrade gracefully on a missing row.
> h3. 3. {{issueInventoryItemToWorkEffort()}} issues stock already reserved elsewhere
> {code:java}
> BigDecimal qoh = inventoryItem.getBigDecimal('quantityOnHandTotal') ?: 0.0
> if (qoh > 0) {
> quantityIssued = (parameters.quantity == null || parameters.quantity > qoh) ? qoh : parameters.quantity
> ...
> }
> {code}
> Before OFBIZ-13262 (the May 2026 inventory-reservation feature), this method gated and sized issuance off {{availableToPromiseTotal}} (ATP), not {{quantityOnHandTotal}} (QOH) — confirmed against the pre-refactor code. QOH ignores existing reservations by other tasks, so this can now issue stock already committed elsewhere (e.g. QOH=100 with 80 reserved → issues up to 100, not the free 20), driving other tasks' ATP negative. This method is unrelated to OFBIZ-13262's own reservation ledger (its only caller is the unrelated marketing-package decomposition flow), the change is never mentioned in that PR's description or review discussion, and the PR's own new test suite never exercises this method — this looks like unintentional collateral damage from a broad refactor pass, not a deliberate design choice.
> h3. 4. {{issueProductionRunTaskComponentInline()}} can abort a whole multi-item issuance
> The outer loop ({{issueProductionRunTaskComponent}}) and this method's own "physical integrity guard" compute item availability with two different formulas that can diverge, so a per-item amount the outer loop believed was safe can still trip the inline hard-fail, aborting the entire multi-item issuance instead of partially issuing and continuing.
> h3. 5. {{handleManualIssuanceOverride()}} swallows a failure from #4
> It calls the inline method as a plain function call (not {{run service:}}, so no auto-throw) and never checks the returned result for an error, so a failure there is silently reported as a success.
> h3. Acceptance criteria
> All five methods are fixed to match their original mini-lang/pre-OFBIZ-13262 behaviour without changing the surrounding refactor.
> h3. Release24.09
> Findings 1 and 2 apply. Findings 3, 4, and 5 do not — release24.09's copy of this file is only 361 lines (pre-OFBIZ-13262); the reservation feature that introduced this code has not been backported there.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)