This is an automated email from the ASF dual-hosted git repository.
mridulpathak 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 bd6e4890c9 Fixed: Two regressions in
OrderRequirementServicesScript.groovy break automatic-requirement generation
(OFBIZ-13603)
bd6e4890c9 is described below
commit bd6e4890c9eec601a8929fb388becae3e30db48b
Author: Mridul Pathak <[email protected]>
AuthorDate: Sat Sep 19 18:53:25 2026 +0530
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.
---
.../apache/ofbiz/order/order/OrderRequirementServicesScript.groovy | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git
a/applications/order/src/main/groovy/org/apache/ofbiz/order/order/OrderRequirementServicesScript.groovy
b/applications/order/src/main/groovy/org/apache/ofbiz/order/order/OrderRequirementServicesScript.groovy
index e5c2e4b7d6..d77ab7eb38 100644
---
a/applications/order/src/main/groovy/org/apache/ofbiz/order/order/OrderRequirementServicesScript.groovy
+++
b/applications/order/src/main/groovy/org/apache/ofbiz/order/order/OrderRequirementServicesScript.groovy
@@ -27,7 +27,7 @@ import org.apache.ofbiz.service.ServiceUtil
* Create OrderRequirementCommitment and Requirement for items with automatic
requirement upon ordering
*/
Map checkCreateOrderRequirement() {
- Map reqMap = getProductRequirementMethod()
+ Map reqMap = getProductRequirementMethod(parameters.productId)
GenericValue order = reqMap.order
if (order.orderTypeId == 'SALES_ORDER' && reqMap.requirementMethodId ==
'PRODRQM_AUTO') {
createRequirementAndCommitment()
@@ -167,7 +167,7 @@ Map checkCreateProductRequirementForFacility() {
for (GenericValue productFacility : products) {
String requirementMethodId =
getProductRequirementMethod(productFacility.productId).requirementMethodId
requirementMethodId = requirementMethodId ?:
parameters.defaultRequirementMethodId
- if (requirementMethodId) {
+ if (requirementMethodId in ['PRODRQM_STOCK', 'PRODRQM_STOCK_ATP']) {
Map result =
getProductFacilityAndQuantities(productFacility.productId,
productFacility.facilityId)
BigDecimal currentQuantity = requirementMethodId ==
'PRODRQM_STOCK' ? result.quantityOnHandTotal : result.availableToPromiseTotal
BigDecimal minimumStock =
productFacility.getBigDecimal('minimumStock')