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 77031d4d7c Fixed: Converted Groovy scripts read configuration with
UtilProperties, ignoring SystemProperty overrides the original mini-lang
honoured (OFBIZ-13655)
77031d4d7c is described below
commit 77031d4d7c3fbe0a2266522c6e41ea27d2865d39
Author: Mridul Pathak <[email protected]>
AuthorDate: Thu Oct 8 00:53:34 2026 +0530
Fixed: Converted Groovy scripts read configuration with UtilProperties,
ignoring SystemProperty overrides the original mini-lang honoured (OFBIZ-13655)
The mini-lang <property-to-field> resolved properties through
EntityUtilProperties, which checks the SystemProperty table before the
.properties file. The converted scripts called UtilProperties directly, so a
SystemProperty value was silently ignored. Read through
EntityUtilProperties.getPropertyValue(..., delegator) instead:
- DataServicesScript: content.upload.always.local.file
- ImageManagementServicesScript: image.management.autoApproveImage and
image.management.multipleApproval
- EmailServicesScript: defaultFromEmailAddress
- CostServices: finaccount.decimals and finaccount.roundingGroovyMethod
- PaymentServices, RateServices, InventoryServicesScript:
currency.uom.id.default
- OrderServicesScript:
shipment.default.cost_actual_over_estimated_percent_allowed
(cherry picked from commit 9f396dce0ff0bce5ef5483dc85745451a3d4ec47)
---
.../apache/ofbiz/accounting/payment/PaymentServices.groovy | 5 +++--
.../org/apache/ofbiz/accounting/rate/RateServices.groovy | 12 +++++++-----
.../org/apache/ofbiz/content/data/DataServicesScript.groovy | 4 +++-
.../apache/ofbiz/product/product/cost/CostServices.groovy | 6 ++++--
.../imagemanagement/ImageManagementServicesScript.groovy | 5 +++--
.../product/product/inventory/InventoryServicesScript.groovy | 4 +++-
.../org/apache/ofbiz/common/email/EmailServicesScript.groovy | 5 +++--
7 files changed, 26 insertions(+), 15 deletions(-)
diff --git
a/applications/accounting/src/main/groovy/org/apache/ofbiz/accounting/payment/PaymentServices.groovy
b/applications/accounting/src/main/groovy/org/apache/ofbiz/accounting/payment/PaymentServices.groovy
index d8006701b8..9914ed75f1 100644
---
a/applications/accounting/src/main/groovy/org/apache/ofbiz/accounting/payment/PaymentServices.groovy
+++
b/applications/accounting/src/main/groovy/org/apache/ofbiz/accounting/payment/PaymentServices.groovy
@@ -272,9 +272,10 @@ Map getPaymentRunningTotal() {
if (parameters.organizationPartyId) {
Map serviceResult = run service: 'getPartyAccountingPreferences',
with: [organizationPartyId: parameters.organizationPartyId]
GenericValue partyAcctgPreference =
serviceResult.partyAccountingPreference
- currencyUomId = partyAcctgPreference.baseCurrencyUomId ?:
UtilProperties.getPropertyValue('general.properties', 'currency.uom.id.default')
+ currencyUomId = partyAcctgPreference.baseCurrencyUomId ?:
+ EntityUtilProperties.getPropertyValue('general',
'currency.uom.id.default', delegator)
} else {
- currencyUomId = UtilProperties.getPropertyValue('general.properties',
'currency.uom.id.default')
+ currencyUomId = EntityUtilProperties.getPropertyValue('general',
'currency.uom.id.default', delegator)
}
return success(paymentRunningTotal:
UtilFormatOut.formatCurrency(runningTotal, currencyUomId, locale))
}
diff --git
a/applications/accounting/src/main/groovy/org/apache/ofbiz/accounting/rate/RateServices.groovy
b/applications/accounting/src/main/groovy/org/apache/ofbiz/accounting/rate/RateServices.groovy
index c66f668fce..871ad2b761 100644
---
a/applications/accounting/src/main/groovy/org/apache/ofbiz/accounting/rate/RateServices.groovy
+++
b/applications/accounting/src/main/groovy/org/apache/ofbiz/accounting/rate/RateServices.groovy
@@ -22,6 +22,7 @@ import org.apache.ofbiz.base.util.UtilDateTime
import org.apache.ofbiz.base.util.UtilProperties
import org.apache.ofbiz.entity.GenericValue
import org.apache.ofbiz.entity.util.EntityUtil
+import org.apache.ofbiz.entity.util.EntityUtilProperties
import org.apache.ofbiz.service.ServiceUtil
import java.sql.Timestamp
@@ -31,7 +32,8 @@ import java.sql.Timestamp
*/
Map updateRateAmount() {
GenericValue newEntity = delegator.makeValidValue('RateAmount', parameters)
- newEntity.rateCurrencyUomId = newEntity.rateCurrencyUomId ?:
UtilProperties.getPropertyValue('general.properties', 'currency.uom.id.default')
+ newEntity.rateCurrencyUomId = newEntity.rateCurrencyUomId ?:
+ EntityUtilProperties.getPropertyValue('general',
'currency.uom.id.default', delegator)
newEntity.fromDate = newEntity.fromDate ?: UtilDateTime.nowTimestamp()
newEntity.thruDate = null
@@ -63,8 +65,8 @@ Map updateRateAmount() {
*/
Map expireRateAmount() {
GenericValue lookedUpValue = delegator.makeValidValue('RateAmount',
parameters)
- lookedUpValue.rateCurrencyUomId = lookedUpValue.rateCurrencyUomId ?:
UtilProperties.getPropertyValue('general.properties',
- 'currency.uom.id.default')
+ lookedUpValue.rateCurrencyUomId = lookedUpValue.rateCurrencyUomId ?:
+ EntityUtilProperties.getPropertyValue('general',
'currency.uom.id.default', delegator)
lookedUpValue = from('RateAmount').where(lookedUpValue).queryOne()
if (lookedUpValue) {
Timestamp previousDay =
UtilDateTime.adjustTimestamp(UtilDateTime.nowTimestamp(), 5, -1)
@@ -166,8 +168,8 @@ Map getRateAmount() {
}
if (serviceName) {
Map serviceContextMap = new HashMap<>(parameters)
- serviceContextMap.rateCurrencyUomId =
serviceContextMap.rateCurrencyUomId ?:
UtilProperties.getPropertyValue('general.properties',
- 'currency.uom.id.default', 'USD')
+ serviceContextMap.rateCurrencyUomId =
serviceContextMap.rateCurrencyUomId ?:
+ EntityUtilProperties.getPropertyValue('general',
'currency.uom.id.default', 'USD', delegator)
Map result = run service: serviceName, with: serviceContextMap
serviceContextMap.ratesList = result.ratesList
result = run service: 'filterRateAmountList', with: serviceContextMap
diff --git
a/applications/content/src/main/groovy/org/apache/ofbiz/content/data/DataServicesScript.groovy
b/applications/content/src/main/groovy/org/apache/ofbiz/content/data/DataServicesScript.groovy
index ff659f85f7..36c7ed1fde 100644
---
a/applications/content/src/main/groovy/org/apache/ofbiz/content/data/DataServicesScript.groovy
+++
b/applications/content/src/main/groovy/org/apache/ofbiz/content/data/DataServicesScript.groovy
@@ -23,6 +23,7 @@ import java.sql.Timestamp
import org.apache.ofbiz.base.util.UtilDateTime
import org.apache.ofbiz.base.util.UtilProperties
import org.apache.ofbiz.entity.GenericValue
+import org.apache.ofbiz.entity.util.EntityUtilProperties
import org.apache.ofbiz.service.ModelService
import org.apache.ofbiz.service.ServiceUtil
@@ -139,7 +140,8 @@ Map getElectronicText() {
*/
Map attachUploadToDataResource() {
boolean isUpdate = false
- boolean forceLocal =
UtilProperties.getPropertyAsBoolean('content.properties',
'content.upload.always.local.file', true)
+ boolean forceLocal = 'true'.equalsIgnoreCase(
+ EntityUtilProperties.getPropertyValue('content',
'content.upload.always.local.file', 'true', delegator))
List validLocalFileTypes = [
'LOCAL_FILE',
'OFBIZ_FILE',
diff --git
a/applications/product/src/main/groovy/org/apache/ofbiz/product/product/cost/CostServices.groovy
b/applications/product/src/main/groovy/org/apache/ofbiz/product/product/cost/CostServices.groovy
index a305be00f8..6f52733c9a 100644
---
a/applications/product/src/main/groovy/org/apache/ofbiz/product/product/cost/CostServices.groovy
+++
b/applications/product/src/main/groovy/org/apache/ofbiz/product/product/cost/CostServices.groovy
@@ -26,6 +26,7 @@ import org.apache.ofbiz.entity.GenericValue
import org.apache.ofbiz.entity.condition.EntityCondition
import org.apache.ofbiz.entity.condition.EntityOperator
import org.apache.ofbiz.entity.util.EntityUtil
+import org.apache.ofbiz.entity.util.EntityUtilProperties
import org.apache.ofbiz.service.ServiceUtil
/**
@@ -459,8 +460,9 @@ Map updateProductAverageCostOnReceiveInventory() {
BigDecimal oldProductQuantity = quantityOnHandTotal -
parameters.quantityAccepted
BigDecimal averageCost = ((productAverageCost.averageCost *
oldProductQuantity)
+ (inventoryItem.unitCost * parameters.quantityAccepted)) /
(quantityOnHandTotal)
- int roundingDecimal =
UtilProperties.getPropertyAsInteger('arithmetic', 'finaccount.decimals', 2)
- String roundingMode = UtilProperties.getPropertyValue('arithmetic',
'finaccount.roundingGroovyMethod', 'HALF_UP')
+ int roundingDecimal =
EntityUtilProperties.getPropertyValue('arithmetic', 'finaccount.decimals', '2',
delegator) as int
+ String roundingMode =
EntityUtilProperties.getPropertyValue('arithmetic',
'finaccount.roundingGroovyMethod',
+ 'HALF_UP', delegator)
averageCost = averageCost.setScale(roundingDecimal,
RoundingMode."${roundingMode}")
productAverageCostMap.averageCost = averageCost
productAverageCostMap.fromDate = UtilDateTime.nowTimestamp()
diff --git
a/applications/product/src/main/groovy/org/apache/ofbiz/product/product/imagemanagement/ImageManagementServicesScript.groovy
b/applications/product/src/main/groovy/org/apache/ofbiz/product/product/imagemanagement/ImageManagementServicesScript.groovy
index 0a6f8ed6a0..aa0e00184f 100644
---
a/applications/product/src/main/groovy/org/apache/ofbiz/product/product/imagemanagement/ImageManagementServicesScript.groovy
+++
b/applications/product/src/main/groovy/org/apache/ofbiz/product/product/imagemanagement/ImageManagementServicesScript.groovy
@@ -25,6 +25,7 @@ import org.apache.ofbiz.base.util.StringUtil
import org.apache.ofbiz.base.util.UtilDateTime
import org.apache.ofbiz.base.util.UtilProperties
import org.apache.ofbiz.entity.GenericValue
+import org.apache.ofbiz.entity.util.EntityUtilProperties
import org.apache.ofbiz.service.ServiceUtil
/**
@@ -283,8 +284,8 @@ Map updateStatusImageManagement() {
if (statusId) {
parameters.checkStatusId = statusId.get(0)
}
- String autoApproveImage =
UtilProperties.getPropertyValue('catalog.properties',
'image.management.autoApproveImage')
- String multipleApproval =
UtilProperties.getPropertyValue('catalog.properties',
'image.management.multipleApproval')
+ String autoApproveImage = EntityUtilProperties.getPropertyValue('catalog',
'image.management.autoApproveImage', delegator)
+ String multipleApproval = EntityUtilProperties.getPropertyValue('catalog',
'image.management.multipleApproval', delegator)
if (autoApproveImage == 'Y') {
List contentApprovals = from('ContentApproval').where(contentId:
parameters.contentId, roleTypeId: 'IMAGEAPPROVER').queryList()
for (GenericValue contentApproval : contentApprovals) {
diff --git
a/applications/product/src/main/groovy/org/apache/ofbiz/product/product/inventory/InventoryServicesScript.groovy
b/applications/product/src/main/groovy/org/apache/ofbiz/product/product/inventory/InventoryServicesScript.groovy
index 846379fc6d..2c9a345179 100644
---
a/applications/product/src/main/groovy/org/apache/ofbiz/product/product/inventory/InventoryServicesScript.groovy
+++
b/applications/product/src/main/groovy/org/apache/ofbiz/product/product/inventory/InventoryServicesScript.groovy
@@ -20,6 +20,7 @@ package org.apache.ofbiz.product.product.inventory
import org.apache.ofbiz.base.util.UtilProperties
import org.apache.ofbiz.entity.GenericValue
+import org.apache.ofbiz.entity.util.EntityUtilProperties
import org.apache.ofbiz.service.ServiceUtil
/**
@@ -140,7 +141,8 @@ Map createInventoryItem() {
if (accPref) {
inventoryItem.currencyUomId = accPref.baseCurrencyUomId
}
- inventoryItem.currencyUomId = inventoryItem.currencyUomId ?:
UtilProperties.getPropertyValue('general.properties', 'currency.uom.id.default')
+ inventoryItem.currencyUomId = inventoryItem.currencyUomId ?:
+ EntityUtilProperties.getPropertyValue('general',
'currency.uom.id.default', delegator)
// if inventoryItem's currencyUomId is still empty, return an error
message
if (!inventoryItem.currencyUomId) {
diff --git
a/framework/common/src/main/groovy/org/apache/ofbiz/common/email/EmailServicesScript.groovy
b/framework/common/src/main/groovy/org/apache/ofbiz/common/email/EmailServicesScript.groovy
index a08eaa6870..a5fd5b4f3c 100644
---
a/framework/common/src/main/groovy/org/apache/ofbiz/common/email/EmailServicesScript.groovy
+++
b/framework/common/src/main/groovy/org/apache/ofbiz/common/email/EmailServicesScript.groovy
@@ -18,8 +18,8 @@
*/
package org.apache.ofbiz.common.email
-import org.apache.ofbiz.base.util.UtilProperties
import org.apache.ofbiz.entity.GenericValue
+import org.apache.ofbiz.entity.util.EntityUtilProperties
import org.apache.ofbiz.service.ModelService
import org.apache.ofbiz.service.ServiceUtil
@@ -54,7 +54,8 @@ Map sendMailFromTemplateSetting() {
if (emailTemplateSetting.fromAddress) {
emailParams.sendFrom = emailTemplateSetting.fromAddress
} else {
- emailParams.sendFrom = UtilProperties.getPropertyValue('general',
'defaultFromEmailAddress', '[email protected]')
+ emailParams.sendFrom =
EntityUtilProperties.getPropertyValue('general', 'defaultFromEmailAddress',
+ '[email protected]', delegator)
}
emailParams.sendCc = emailTemplateSetting.ccAddress
emailParams.sendBcc = emailTemplateSetting.bccAddress