diff --git a/mifosng-provider/src/main/java/org/mifosng/platform/api/commands/LoanApplicationCommand.java b/mifosng-provider/src/main/java/org/mifosng/platform/api/commands/LoanApplicationCommand.java index d44dbe4fe..27d9f5b4c 100644 --- a/mifosng-provider/src/main/java/org/mifosng/platform/api/commands/LoanApplicationCommand.java +++ b/mifosng-provider/src/main/java/org/mifosng/platform/api/commands/LoanApplicationCommand.java @@ -247,4 +247,16 @@ public class LoanApplicationCommand { public boolean isSubmittedOnDateChanged() { return this.modifiedParameters.contains("submittedOnDate"); } + + public boolean isExpectedDisbursementDateChanged() { + return this.modifiedParameters.contains("expectedDisbursementDate"); + } + + public boolean isRepaymentsStartingFromDateChanged() { + return this.modifiedParameters.contains("repaymentsStartingFromDate"); + } + + public boolean isInterestChargedFromDateChanged() { + return this.modifiedParameters.contains("interestChargedFromDate"); + } } \ No newline at end of file diff --git a/mifosng-provider/src/main/java/org/mifosng/platform/loan/domain/Loan.java b/mifosng-provider/src/main/java/org/mifosng/platform/loan/domain/Loan.java index 5eaef00b4..d2e42ec32 100644 --- a/mifosng-provider/src/main/java/org/mifosng/platform/loan/domain/Loan.java +++ b/mifosng-provider/src/main/java/org/mifosng/platform/loan/domain/Loan.java @@ -226,6 +226,30 @@ public class Loan extends AbstractAuditableCustom { this.submittedOnDate = command.getSubmittedOnDate().toDate(); } + if (command.isExpectedDisbursementDateChanged()) { + if (command.getExpectedDisbursementDate() != null) { + this.expectedDisbursedOnDate = command.getExpectedDisbursementDate().toDate(); + } else { + this.expectedDisbursedOnDate = null; + } + } + + if (command.isRepaymentsStartingFromDateChanged()) { + if (command.getRepaymentsStartingFromDate() != null) { + this.expectedFirstRepaymentOnDate = command.getRepaymentsStartingFromDate().toDate(); + } else { + this.expectedFirstRepaymentOnDate = null; + } + } + + if (command.isInterestChargedFromDateChanged()) { + if (command.getInterestChargedFromDate() != null) { + this.interestChargedFromDate = command.getInterestChargedFromDate().toDate(); + } else { + this.interestChargedFromDate = null; + } + } + this.loanRepaymentScheduleDetail.update(command.toLoanProductCommand()); // FIXME - rewrite over loan schedule by default for now but worth putting in check to see if required @@ -474,7 +498,7 @@ public class Loan extends AbstractAuditableCustom { if (loanTransactionDate.isAfter(new LocalDate())) { final String errorMessage = "The transaction date cannot be in the future."; throw new InvalidLoanStateTransitionException("waive", - "cannot.be.a.futre.date", errorMessage, loanTransactionDate); + "cannot.be.a.future.date", errorMessage, loanTransactionDate); } if (getTotalOutstanding().isGreaterThan(this.getInArrearsTolerance())) { @@ -534,7 +558,7 @@ public class Loan extends AbstractAuditableCustom { if (loanTransactionDate.isAfter(new LocalDate())) { final String errorMessage = "The transaction date cannot be in the future."; throw new InvalidLoanStateTransitionException("repayment", - "cannot.be.a.futre.date", errorMessage, loanTransactionDate); + "cannot.be.a.future.date", errorMessage, loanTransactionDate); } List repaymentsOrWaivers = new ArrayList();