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 b75f858522 Fixed: filterRateAmountList sequential filtering and
fallback behavior (OFBIZ-13543)
b75f858522 is described below
commit b75f85852229c7931037d4459239d0b19f9d9b2c
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 7de382ff39..3df7632bfa 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
@@ -252,23 +252,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