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 11ffcceb2d Fix regressions in RequirementServicesScript and
OrderDeliveryServices
11ffcceb2d is described below
commit 11ffcceb2de48e6fe6b44543bc60611f9733bd80
Author: Mridul Pathak <[email protected]>
AuthorDate: Thu Oct 22 21:26:16 2026 +0530
Fix regressions in RequirementServicesScript and OrderDeliveryServices
Two regressions from the minilang conversion:
- autoAssignRequirementToSupplier assigns a requirement with a quantity of
0, as the minilang if-not-empty did, instead of skipping it because of Groovy
truthiness.
- sendOrderDeliveryScheduleNotification no longer throws a
NullPointerException when the current user has no email address or the schedule
is missing, it skips the sender and logs that there is insufficient data, as
the minilang did.
---
.../org/apache/ofbiz/order/order/OrderDeliveryServices.groovy | 9 ++++++---
.../ofbiz/order/requirement/RequirementServicesScript.groovy | 2 +-
2 files changed, 7 insertions(+), 4 deletions(-)
diff --git
a/applications/order/src/main/groovy/org/apache/ofbiz/order/order/OrderDeliveryServices.groovy
b/applications/order/src/main/groovy/org/apache/ofbiz/order/order/OrderDeliveryServices.groovy
index cc13f39b6c..36f57766d6 100644
---
a/applications/order/src/main/groovy/org/apache/ofbiz/order/order/OrderDeliveryServices.groovy
+++
b/applications/order/src/main/groovy/org/apache/ofbiz/order/order/OrderDeliveryServices.groovy
@@ -81,7 +81,10 @@ Map sendOrderDeliveryScheduleNotification() {
// find email address for currently logged in user, set as sendFrom
Map curUserPcmFindMap = [partyId: userLogin.partyId, contactMechTypeId:
'EMAIL_ADDRESS']
GenericValue curUserPartyAndContactMech =
from('PartyAndContactMech').where(curUserPcmFindMap).queryFirst()
- Map sendEmailMap = [sendFrom: curUserPartyAndContactMech.infoString]
+ Map sendEmailMap = [:]
+ if (curUserPartyAndContactMech) {
+ sendEmailMap.sendFrom = curUserPartyAndContactMech.infoString
+ }
// find email addresses of all parties in SHIPMENT_CLERK roleTypeId, set
as sendTo
Map shipmentClerkFindMap = [roleTypeId: 'SHIPMENT_CLERK']
@@ -104,8 +107,8 @@ Map sendOrderDeliveryScheduleNotification() {
}
}
// set subject, contentType, templateName, templateData
- sendEmailMap.subject = 'Delivery Information Updated for Order #' +
orderDeliverySchedule.orderId
- if (orderDeliverySchedule.orderItemSeqId != '_NA_') {
+ sendEmailMap.subject = 'Delivery Information Updated for Order #' +
(orderDeliverySchedule?.orderId ?: '')
+ if (orderDeliverySchedule && orderDeliverySchedule.orderItemSeqId !=
'_NA_') {
StringBuilder newSubject = new StringBuilder()
newSubject.append(sendEmailMap.subject)
newSubject.append(' Item #' + orderDeliverySchedule.orderItemSeqId)
diff --git
a/applications/order/src/main/groovy/org/apache/ofbiz/order/requirement/RequirementServicesScript.groovy
b/applications/order/src/main/groovy/org/apache/ofbiz/order/requirement/RequirementServicesScript.groovy
index 1bc6954797..02a1f22044 100644
---
a/applications/order/src/main/groovy/org/apache/ofbiz/order/requirement/RequirementServicesScript.groovy
+++
b/applications/order/src/main/groovy/org/apache/ofbiz/order/requirement/RequirementServicesScript.groovy
@@ -50,7 +50,7 @@ Map autoAssignRequirementToSupplier() {
if (requirement) {
if (requirement.requirementTypeId == 'PRODUCT_REQUIREMENT'
&& requirement.productId
- && requirement.quantity) {
+ && requirement.quantity != null) {
EntityCondition condition = new EntityConditionBuilder().AND {
EQUALS(productId: requirement.productId)
LESS_THAN_EQUAL_TO(minimumOrderQuantity: requirement.quantity)