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 2854339827 Fixed: updatePartyRate does not persist expiry of the 
previous rate (OFBIZ-13590)
2854339827 is described below

commit 2854339827d1512236d112b7f21bf44b9298c5e0
Author: Mridul Pathak <[email protected]>
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 3df7632bfa..c66f668fce 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()

Reply via email to