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 ab5787489e Fix parent organizations overriding child accounting
preferences
ab5787489e is described below
commit ab5787489ee621b2897534829780469b8dbf1de9
Author: Mridul Pathak <[email protected]>
AuthorDate: Thu Oct 22 18:26:57 2026 +0530
Fix parent organizations overriding child accounting preferences
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.
---
.../ofbiz/accounting/admin/AcctgAdminServices.groovy | 14 +++++++++-----
1 file changed, 9 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 9b609a2c0b..75f8159f26 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,6 +21,7 @@ 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
@@ -55,11 +56,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 {