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 617066ac56 Fixed: Converted Groovy scripts read configuration with
UtilProperties, ignoring SystemProperty overrides the original mini-lang
honoured (OFBIZ-13655)
617066ac56 is described below
commit 617066ac564076a0074f4e17f390e7aa183e57d1
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
---
.../apache/ofbiz/accounting/payment/PaymentServices.groovy | 5 +++--
.../org/apache/ofbiz/accounting/rate/RateServices.groovy | 13 +++++++------
.../org/apache/ofbiz/content/data/DataServicesScript.groovy | 4 +++-
.../org/apache/ofbiz/order/order/OrderServicesScript.groovy | 5 +++--
.../apache/ofbiz/product/product/cost/CostServices.groovy | 6 ++++--
.../imagemanagement/ImageManagementServicesScript.groovy | 5 +++--
.../product/inventory/InventoryServicesScript.groovy | 4 +++-
.../apache/ofbiz/common/email/EmailServicesScript.groovy | 5 +++--
8 files changed, 29 insertions(+), 18 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 7e3f98360f..b4820f5fa6 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
@@ -264,9 +264,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 dba46e33ab..a1243cdcc8 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
@@ -19,9 +19,9 @@
package org.apache.ofbiz.accounting.rate
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.ServiceErrorException
import org.apache.ofbiz.service.ServiceUtil
@@ -32,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
@@ -64,8 +65,8 @@ Map updateRateAmount() {
*/
Map expireRateAmount() {
GenericValue lookupValue = delegator.makeValidValue('RateAmount',
parameters)
- lookupValue.rateCurrencyUomId = lookupValue.rateCurrencyUomId ?:
UtilProperties.getPropertyValue('general.properties',
- 'currency.uom.id.default')
+ lookupValue.rateCurrencyUomId = lookupValue.rateCurrencyUomId ?:
+ EntityUtilProperties.getPropertyValue('general',
'currency.uom.id.default', delegator)
Timestamp previousDay =
UtilDateTime.adjustTimestamp(UtilDateTime.nowTimestamp(), 5, -1)
try {
update('RateAmount').where(lookupValue).set([thruDate:
UtilDateTime.getDayEnd(previousDay)])
@@ -165,8 +166,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 1ee50fcdec..a4f3566fa1 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
@@ -131,7 +132,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/order/src/main/groovy/org/apache/ofbiz/order/order/OrderServicesScript.groovy
b/applications/order/src/main/groovy/org/apache/ofbiz/order/order/OrderServicesScript.groovy
index 038d7db87f..c10ed5daaf 100644
---
a/applications/order/src/main/groovy/org/apache/ofbiz/order/order/OrderServicesScript.groovy
+++
b/applications/order/src/main/groovy/org/apache/ofbiz/order/order/OrderServicesScript.groovy
@@ -23,11 +23,11 @@ import java.sql.Timestamp
import org.apache.ofbiz.base.util.GeneralException
import org.apache.ofbiz.base.util.ObjectType
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.condition.EntityCondition
import org.apache.ofbiz.entity.condition.EntityConditionBuilder
import org.apache.ofbiz.entity.condition.EntityOperator
+import org.apache.ofbiz.entity.util.EntityUtilProperties
import org.apache.ofbiz.order.customer.CheckoutMapProcs
import org.apache.ofbiz.order.shoppingcart.ShoppingCart
import org.apache.ofbiz.order.shoppingcart.ShoppingCart.CartShipInfo
@@ -829,7 +829,8 @@ Map updateShippingMethodAndCharges() {
BigDecimal newAmount
BigDecimal shippingAmount
BigDecimal percentAllowedBd
- String percentAllowed =
UtilProperties.getPropertyValue('shipment.properties',
'shipment.default.cost_actual_over_estimated_percent_allowed')
+ String percentAllowed = EntityUtilProperties.getPropertyValue('shipment',
+ 'shipment.default.cost_actual_over_estimated_percent_allowed',
delegator)
try {
newAmount = (BigDecimal)
ObjectType.simpleTypeOrObjectConvert(parameters.amount, 'BigDecimal', null,
locale)
shippingAmount = (BigDecimal)
ObjectType.simpleTypeOrObjectConvert(parameters.shippingAmount, 'BigDecimal',
null, locale)
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 2897f3ca9a..2f1774d06b 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 117961c1a9..1c07be8b6b 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
@@ -23,6 +23,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
import java.sql.Timestamp
@@ -253,8 +254,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 35d7b1558e..904d9d639a 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
/**
@@ -132,7 +133,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
require(inventoryItem.currencyUomId as boolean,
label('ProductUiLabels', 'FacilityInventoryItemsMissingCurrencyId'))
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 ae4d401caf..bc2d441ca6 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