From f574ea765949e6ca30480e4462174c49c650aae6 Mon Sep 17 00:00:00 2001 From: Adam Saghy Date: Tue, 17 Jan 2023 17:10:51 +0100 Subject: [PATCH] FINERACT-1724: Fix loan status change bug at the event of transaction replay --- .../apache/fineract/portfolio/loanaccount/domain/Loan.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/domain/Loan.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/domain/Loan.java index 2902c0222..6d883595a 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/domain/Loan.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/domain/Loan.java @@ -3202,8 +3202,6 @@ public class Loan extends AbstractAuditableWithUTCDateTimeCustom { if (loanTransaction.isRecoveryRepayment()) { loanLifecycleStateMachine.transition(LoanEvent.LOAN_RECOVERY_PAYMENT, this); - } else { - loanLifecycleStateMachine.transition(LoanEvent.LOAN_REPAYMENT_OR_WAIVER, this); } if (loanTransaction.isRecoveryRepayment() @@ -3433,6 +3431,8 @@ public class Loan extends AbstractAuditableWithUTCDateTimeCustom { } else if (this.summary.isRepaidInFull(loanCurrency())) { handleLoanRepaymentInFull(transactionDate, loanLifecycleStateMachine); statusChanged = true; + } else { + loanLifecycleStateMachine.transition(LoanEvent.LOAN_REPAYMENT_OR_WAIVER, this); } if (this.totalOverpaid == null || BigDecimal.ZERO.compareTo(this.totalOverpaid) == 0) { this.overpaidOnDate = null;