From ca038a8ebf809babd63aca038ba715114c2ed986 Mon Sep 17 00:00:00 2001 From: ashok-conflux Date: Wed, 27 Mar 2013 19:30:04 +0530 Subject: [PATCH] bug fix: MIFOSX-201 and MIFOSX-202 --- .../domain/DefaultLoanLifecycleStateMachine.java | 2 +- .../mifosplatform/portfolio/loanaccount/domain/Loan.java | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanaccount/domain/DefaultLoanLifecycleStateMachine.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanaccount/domain/DefaultLoanLifecycleStateMachine.java index 1dcb5842a..5a0e96c02 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanaccount/domain/DefaultLoanLifecycleStateMachine.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanaccount/domain/DefaultLoanLifecycleStateMachine.java @@ -37,7 +37,7 @@ public class DefaultLoanLifecycleStateMachine implements LoanLifecycleStateMachi } break; case LOAN_WITHDRAWN: - if (this.anyOfAllowedWhenComingFrom(from, LoanStatus.SUBMITTED_AND_PENDING_APPROVAL, LoanStatus.APPROVED)) { + if (this.anyOfAllowedWhenComingFrom(from, LoanStatus.SUBMITTED_AND_PENDING_APPROVAL)) { newState = stateOf(LoanStatus.WITHDRAWN_BY_CLIENT, allowedLoanStatuses); } break; diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanaccount/domain/Loan.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanaccount/domain/Loan.java index 49f2190fb..7d6e48159 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanaccount/domain/Loan.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanaccount/domain/Loan.java @@ -1099,6 +1099,9 @@ public class Loan extends AbstractPersistable { final String errorMessage = "The date on which a loan is rejected cannot be in the future."; throw new InvalidLoanStateTransitionException("reject", "cannot.be.a.future.date", errorMessage, rejectedOn); } + }else{ + final String errorMessage = "Only the Loan applications with status 'Submitted and Pending approval' are allowed to reject."; + throw new InvalidLoanStateTransitionException("reject", "cannot.reject", errorMessage); } return actualChanges; @@ -1143,6 +1146,9 @@ public class Loan extends AbstractPersistable { final String errorMessage = "The date on which a loan is withdrawn cannot be in the future."; throw new InvalidLoanStateTransitionException("reject", "cannot.be.a.future.date", errorMessage, command); } + }else{ + final String errorMessage = "Only the Loan applications with status 'Submitted and Pending approval' are allowed to Withdraw By Client."; + throw new InvalidLoanStateTransitionException("withdraw", "cannot.withdraw", errorMessage); } return actualChanges;