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 b1cfd11a78 Fixed: getFXConversion fails instead of defaulting to 1
when no rate configured (OFBIZ-13531)
b1cfd11a78 is described below
commit b1cfd11a7898ddfa72ea0e814dc6fddd2e9bf4d8
Author: Mridul Pathak <[email protected]>
AuthorDate: Wed Sep 9 20:08:28 2026 +0530
Fixed: getFXConversion fails instead of defaulting to 1 when no rate
configured (OFBIZ-13531)
Restore the original minilang behavior in getFXConversion where an
unconfigured currency pair gracefully defaults conversionRate to 1 and returns
success, replacing the Groovy conversion's hard error return with a warning log.
---
.../org/apache/ofbiz/accounting/admin/AcctgAdminServices.groovy | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git
a/applications/accounting/src/main/groovy/org/apache/ofbiz/accounting/admin/AcctgAdminServices.groovy
b/applications/accounting/src/main/groovy/org/apache/ofbiz/accounting/admin/AcctgAdminServices.groovy
index c938bb1a79..9b609a2c0b 100644
---
a/applications/accounting/src/main/groovy/org/apache/ofbiz/accounting/admin/AcctgAdminServices.groovy
+++
b/applications/accounting/src/main/groovy/org/apache/ofbiz/accounting/admin/AcctgAdminServices.groovy
@@ -156,16 +156,14 @@ Map getFXConversion() {
}
List<GenericValue> rates =
select().from('UomConversionDated').where(condition).orderBy('-fromDate').filterByDate().queryList()
- BigDecimal conversionRate
+ BigDecimal conversionRate = BigDecimal.ONE
int decimalScale = 2
if (rates) {
conversionFactor =
EntityUtil.getFirst(rates).getBigDecimal('conversionFactor')
BigDecimal originalValue = BigDecimal.ONE
conversionRate = originalValue.divide(conversionFactor, decimalScale,
RoundingMode.HALF_UP)
} else {
- String errorMessage = 'Could not find conversion rate'
- logError(errorMessage)
- return error(errorMessage)
+ logWarning('Could not find conversion rate')
}
result.put('conversionRate', conversionRate)
return result