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 153d269793 Fixed: Mini-lang to Groovy regressions in
CommonServicesScript (OFBIZ-13570)
153d269793 is described below
commit 153d269793c3492af279bab5b952c9b89046e549
Author: Mridul Pathak <[email protected]>
AuthorDate: Fri Sep 11 17:17:42 2026 +0530
Fixed: Mini-lang to Groovy regressions in CommonServicesScript (OFBIZ-13570)
- convertUom: query UomConversion using explicit PK fields (uomId, uomIdTo)
instead of entire parameters map, and move verbose conversion factor log after
null check.
- getVisualThemeResources: accumulate resourceValue Strings into a List per
resourceTypeEnumId, fixing single map overwrite and resouceTypeEnumId typo.
- linkGeos: guard against NullPointerException when geoIds parameter is
null or omitted.
- checkUomConversion: check queryCount() > 0 instead of == 1.
- checkUomConversionDated: query UomConversionDated instead of
UomConversion entity, and check queryCount() > 0 instead of == 1.
---
.../org/apache/ofbiz/common/CommonServicesScript.groovy | 17 +++++++++++------
1 file changed, 11 insertions(+), 6 deletions(-)
diff --git
a/framework/common/src/main/groovy/org/apache/ofbiz/common/CommonServicesScript.groovy
b/framework/common/src/main/groovy/org/apache/ofbiz/common/CommonServicesScript.groovy
index b6a01a95f7..6514682006 100644
---
a/framework/common/src/main/groovy/org/apache/ofbiz/common/CommonServicesScript.groovy
+++
b/framework/common/src/main/groovy/org/apache/ofbiz/common/CommonServicesScript.groovy
@@ -91,13 +91,17 @@ Map convertUom() {
}
// if not found, try the uom conversion entity
- uomConversion = uomConversion ?:
from('UomConversion').where(parameters).cache().queryOne()
- logVerbose("using conversion factor=${uomConversion.conversionFactor}")
+ uomConversion = uomConversion ?: from('UomConversion')
+ .where(uomId: parameters.uomId,
+ uomIdTo: parameters.uomIdTo)
+ .cache()
+ .queryOne()
if (!uomConversion) {
// if still no uom conversion entity, then no conversion is possible
return error(UtilProperties.getMessage('CommonUiLabels',
'CommonNoUomConversionFound', parameters.locale))
}
+ logVerbose("using conversion factor=${uomConversion.conversionFactor}")
// Do custom conversion, if we have customMethodId
if (uomConversion.customMethodId) { //custom conversion?
logVerbose("using custom conversion
customMethodId=${uomConversion.customMethodId}")
@@ -204,7 +208,8 @@ Map getVisualThemeResources() {
String resourceTypeEnumId = resourceRecord.resourceTypeEnumId
String resourceValue = resourceRecord.resourceValue
if (resourceValue) {
- themeResources[resourceTypeEnumId] = [resouceTypeEnumId:
resourceValue]
+ themeResources[resourceTypeEnumId] =
themeResources[resourceTypeEnumId] ?: []
+ themeResources[resourceTypeEnumId] << resourceValue
} else {
logWarning(UtilProperties.getMessage('CommonUiLabels',
'CommonVisualThemeInvalidRecord', parameters.locale))
}
@@ -256,7 +261,7 @@ Map linkGeos() {
.cache()
.getFieldList('geoIdTo')
// Old list contains current values
- for (String geoIdTo : parameters.geoIds) {
+ for (String geoIdTo : parameters.geoIds ?: []) {
if (!oldGeoIds?.contains(geoIdTo)) {
// If it already exist, nothing to do and we keep it
GenericValue oldGeoAssoc = from('GeoAssoc').where(geoId:
parameters.geoId, geoIdTo: geoIdTo).queryOne()
@@ -293,7 +298,7 @@ Map getRelatedGeos() {
*/
Map checkUomConversion() {
Map result = success()
- result.exist = from('UomConversion').where(uomId: parameters.uomId,
uomIdTo: parameters.uomIdTo).queryCount() == 1
+ result.exist = from('UomConversion').where(uomId: parameters.uomId,
uomIdTo: parameters.uomIdTo).queryCount() > 0
return result
}
@@ -309,7 +314,7 @@ Map checkUomConversionDated() {
if (parameters.purposeEnumId) {
condition.purposeEnumId = parameters.purposeEnumId
}
- result.exist =
from('UomConversion').where(condition).filterByDate().queryCount() == 1
+ result.exist =
from('UomConversionDated').where(condition).filterByDate().queryCount() > 0
return result
}