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/19 13:53:00 UTC

[jira] [Commented] (OFBIZ-13603) Two regressions in OrderRequirementServicesScript.groovy break automatic-requirement generation

    [ https://issues.apache.org/jira/browse/OFBIZ-13603?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18117054#comment-18117054 ] 

ASF subversion and git services commented on OFBIZ-13603:
---------------------------------------------------------

Commit bd6e4890c9eec601a8929fb388becae3e30db48b in ofbiz-framework's branch refs/heads/trunk from Mridul Pathak
[ https://gitbox.apache.org/repos/asf?p=ofbiz-framework.git;h=bd6e4890c9 ]

Fixed: Two regressions in OrderRequirementServicesScript.groovy break automatic-requirement generation (OFBIZ-13603)

- checkCreateOrderRequirement() called getProductRequirementMethod() with no
  arguments, against a signature a later commit in the same conversion
  changed to require (String productId) for its own new call sites. Groovy's
  script-method dispatch silently pads the missing argument with null rather
  than throwing, so this doesn't crash -- it silently no-ops instead: with
  productId always null, the Product lookup always misses, so the
  PRODRQM_AUTO branch never fires even for a product genuinely configured
  with PRODRQM_AUTO. Fixed by passing parameters.productId explicitly.
- checkCreateProductRequirementForFacility() used a bare truthy check
  (if (requirementMethodId)) where the pre-conversion minilang required an
  exact match against PRODRQM_STOCK/PRODRQM_STOCK_ATP. The PROD_REQ_METHOD
  enum has 7 values, so any of the other 5 (including PRODRQM_NONE,
  explicitly "no requirement") were incorrectly processed, capable of
  spawning a spurious requirement off the wrong quantity metric.

Verified with temporary RED/GREEN tests; full order component suite passes.


> Two regressions in OrderRequirementServicesScript.groovy break automatic-requirement generation
> -----------------------------------------------------------------------------------------------
>
>                 Key: OFBIZ-13603
>                 URL: https://issues.apache.org/jira/browse/OFBIZ-13603
>             Project: OFBiz
>          Issue Type: Bug
>          Components: order
>    Affects Versions: Upcoming Branch
>            Reporter: Mridul Pathak
>            Assignee: Mridul Pathak
>            Priority: Major
>
> h3. Needs fixing
> {{applications/order/src/main/groovy/org/apache/ofbiz/order/order/OrderRequirementServicesScript.groovy}} has two distinct regressions, both introduced within the same overall OFBIZ-9984 conversion effort:
> * {{checkCreateOrderRequirement()}} calls {{getProductRequirementMethod()}} with no arguments. A later commit within the same OFBIZ-9984 conversion changed {{getProductRequirementMethod}}'s signature to {{getProductRequirementMethod(String productId)}} — needed for two new call sites it was adding ({{checkCreateProductRequirementForFacility}}, {{getStockRequirementMethod}}) — but never updated this original, pre-existing call site. *Correction:* this does not throw an exception — Groovy's dispatch for methods declared at script top level silently pads the missing trailing argument with {{null}} rather than raising {{MissingMethodException}}. The real effect is a silent no-op: with {{productId}} always {{null}}, the {{Product}} lookup inside {{getProductRequirementMethod()}} always misses, so {{requirementMethodId}} is always empty and the {{PRODRQM_AUTO}} branch never fires — even for a product genuinely configured with {{PRODRQM_AUTO}} ("Automatic For Every Sales Order"). The service that's supposed to auto-create a {{Requirement}}/{{OrderRequirementCommitment}} for such products silently never does. Needs fixing: change the call to {{getProductRequirementMethod(parameters.productId)}}.
> * {{checkCreateProductRequirementForFacility()}} checks {{if (requirementMethodId)}} (a plain truthy check) where the pre-conversion minilang required an exact match against {{'PRODRQM_STOCK'}} or {{'PRODRQM_STOCK_ATP'}}. The {{PROD_REQ_METHOD}} enumeration has seven real values ({{PRODRQM_NONE}}, {{PRODRQM_AUTO}}, {{PRODRQM_STOCK}}, {{PRODRQM_STOCK_ATP}}, {{PRODRQM_ATP}}, {{PRODRQM_DS}}, {{PRODRQM_DSATP}}), so a product or store configured with any of the other five — including {{PRODRQM_NONE}}, which explicitly means "No Requirement Created" — is incorrectly processed by this facility-wide batch check, and can generate a spurious {{PRODUCT_REQUIREMENT}} record computed off the wrong quantity metric (the ternary treats anything that isn't literally {{'PRODRQM_STOCK'}} as an ATP case). Needs fixing: restore the exact-match condition, e.g. {{if (requirementMethodId in ['PRODRQM_STOCK', 'PRODRQM_STOCK_ATP'])}}.
> Acceptance criteria: both fixed, with regression tests covering at least one successful {{checkCreateOrderRequirement}} call against a {{PRODRQM_AUTO}}-configured product (asserting a requirement/commitment is actually created) and one {{checkCreateProductRequirementForFacility}} call against a product configured with {{PRODRQM_NONE}} (asserting no requirement is created).



--
This message was sent by Atlassian Jira
(v8.20.10#820010)