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 b139d64cc1 Fixed: filterRateAmountList sequential filtering and
fallback behavior (OFBIZ-13543)
b139d64cc1 is described below
commit b139d64cc1b4100a2327cf1d74150c6763794bba
Author: Mridul Pathak <[email protected]>
AuthorDate: Thu Sep 10 11:59:55 2026 +0530
Fixed: filterRateAmountList sequential filtering and fallback behavior
(OFBIZ-13543)
- Filter rate amount list sequentially by workEffortId, partyId,
emplPositionTypeId, and rateTypeId
- Fall back to the previous non-empty working list if a narrowing criterion
yields no results
---
.../ofbiz/accounting/rate/RateServices.groovy | 25 +++++++---------------
1 file changed, 8 insertions(+), 17 deletions(-)
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 dd07af61d6..b3b47dc4cb 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
@@ -254,23 +254,14 @@ Map filterRateAmountList() {
return success()
}
//Check if there is a more specific rate
- Map filterMap = [:]
- if (parameters.workEffortId) {
- filterMap.workEffortId = parameters.workEffortId
- }
- if (parameters.partyId) {
- filterMap.partyId = parameters.partyId
- }
- if (parameters.emplPositionTypeId) {
- filterMap.emplPositionTypeId = parameters.emplPositionTypeId
- }
- if (parameters.rateTypeId) {
- filterMap.rateTypeId = parameters.rateTypeId
- }
- List tempRatesFilteredList = EntityUtil.filterByAnd(parameters.ratesList,
filterMap)
- List ratesList = []
- if (tempRatesFilteredList) {
- ratesList = tempRatesFilteredList
+ List ratesList = parameters.ratesList
+ for (String field : ['workEffortId', 'partyId', 'emplPositionTypeId',
'rateTypeId']) {
+ if (parameters[field]) {
+ List tempRatesFilteredList = EntityUtil.filterByAnd(ratesList,
[(field): parameters[field]])
+ if (tempRatesFilteredList) {
+ ratesList = tempRatesFilteredList
+ }
+ }
}
Map result = success()
result.filteredRatesList = ratesList