You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by mr...@apache.org on 2026/09/15 13:13:17 UTC
(ofbiz-framework) branch trunk updated: Fixed: updatePartyRate does not persist expiry of the previous rate (OFBIZ-13590)
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 e4fb4b7886 Fixed: updatePartyRate does not persist expiry of the previous rate (OFBIZ-13590)
e4fb4b7886 is described below
commit e4fb4b7886c32d694da840018927313c93f8aa28
Author: Mridul Pathak <mr...@gmail.com>
AuthorDate: Tue Sep 15 18:10:01 2026 +0530
Fixed: updatePartyRate does not persist expiry of the previous rate (OFBIZ-13590)
- The method set partyRate.thruDate = UtilDateTime.nowTimestamp() to expire the previously active PartyRate but never called .store(), so the mutation only existed in memory and was discarded; multiple "active" PartyRate rows accumulated for the same party/rateType since none of the earlier ones actually got expired
- The lookup for that previous PartyRate was also missing filterByDate() (present in the original minilang), so getFirst() could pick an already-expired row instead of the currently active one to expire
Both fixes were verified against the original minilang and covered by a temporary RED/GREEN test before removal, and the accounting component's rate test suite passes unchanged.
---
.../main/groovy/org/apache/ofbiz/accounting/rate/RateServices.groovy | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
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 b3b47dc4cb..d883049f50 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
@@ -83,10 +83,11 @@ Map deleteRateAmount() {
}
Map updatePartyRate() {
- List<GenericValue> partyRates = from('PartyRate').where([partyId: partyId, rateTypeId: rateTypeId]).queryList()
+ List<GenericValue> partyRates = from('PartyRate').where([partyId: partyId, rateTypeId: rateTypeId]).filterByDate().queryList()
if (partyRates) {
GenericValue partyRate = EntityUtil.getFirst(partyRates)
partyRate.thruDate = UtilDateTime.nowTimestamp()
+ partyRate.store()
}
GenericValue newEntity = delegator.makeValidValue('PartyRate', parameters)
newEntity.fromDate = newEntity.fromDate ?: UtilDateTime.nowTimestamp()