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 aa32b519b3 Fix parent organizations overriding child accounting
preferences and a missing import in AcctgAdminServices
aa32b519b3 is described below
commit aa32b519b317e498257dfcf2e9711bb80891d0f9
Author: Mridul Pathak <[email protected]>
AuthorDate: Thu Oct 22 18:26:57 2026 +0530
Fix parent organizations overriding child accounting preferences and a
missing import in AcctgAdminServices
Two regressions in AcctgAdminServices.groovy:
- getPartyAccountingPreferences only takes a value from an ancestor when
the aggregate still has no value for that field, as the minilang did, so the
organization's own settings and those of closer ancestors are no longer
overwritten by a parent organization. Emptiness is checked with
ObjectType.isEmpty like the minilang, so a numeric 0 counts as a value.
- createFuturePeriod imports ServiceUtil, which got lost when the service
moved from framework/common, so the service no longer fails with a
MissingPropertyException as soon as it has to create a period.
---
.../ofbiz/accounting/admin/AcctgAdminServices.groovy | 15 ++++++++++-----
1 file changed, 10 insertions(+), 5 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 c2032de6e4..3789b0e995 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
@@ -21,12 +21,14 @@ package org.apache.ofbiz.accounting.admin
import java.math.RoundingMode
import java.sql.Timestamp
+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.EntityConditionBuilder
import org.apache.ofbiz.entity.util.EntityUtil
import org.apache.ofbiz.service.ModelService
+import org.apache.ofbiz.service.ServiceUtil
import java.text.SimpleDateFormat
@@ -56,11 +58,14 @@ Map getPartyAccountingPreferences() {
containsEmptyFields = false
if (currentPartyAcctgPref) {
for (String entityKey : currentPartyAcctgPref.keySet()) {
- Object entityValue = currentPartyAcctgPref.get(entityKey)
- if (entityValue) {
- aggregatedPartyAcctgPref.put(entityKey, entityValue)
- } else {
- containsEmptyFields = true
+ // a value already supplied by the organization itself or by a
closer ancestor is never overridden
+ if
(ObjectType.isEmpty(aggregatedPartyAcctgPref.get(entityKey))) {
+ Object entityValue = currentPartyAcctgPref.get(entityKey)
+ if (ObjectType.isEmpty(entityValue)) {
+ containsEmptyFields = true
+ } else {
+ aggregatedPartyAcctgPref.put(entityKey, entityValue)
+ }
}
}
} else {