Merge branch 'PullREQUEST73' into develop
This commit is contained in:
+7
-6
@@ -579,7 +579,7 @@ public class Loan extends AbstractPersistable<Long> {
|
||||
getId(), loanCharge.name());
|
||||
}
|
||||
|
||||
validateChargeHasValidSpecifiedDateIfApplicable(loanCharge, getDisbursementDate(), getLastRepaymentPeriodDueDate());
|
||||
validateChargeHasValidSpecifiedDateIfApplicable(loanCharge, getDisbursementDate(), getLastRepaymentPeriodDueDate(false));
|
||||
|
||||
loanCharge.update(this);
|
||||
|
||||
@@ -735,10 +735,11 @@ public class Loan extends AbstractPersistable<Long> {
|
||||
}
|
||||
}
|
||||
|
||||
private LocalDate getLastRepaymentPeriodDueDate() {
|
||||
private LocalDate getLastRepaymentPeriodDueDate(final boolean includeRecalculatedInterestComponent) {
|
||||
LocalDate lastRepaymentDate = getDisbursementDate();
|
||||
for (LoanRepaymentScheduleInstallment installment : this.repaymentScheduleInstallments) {
|
||||
if (!installment.isRecalculatedInterestComponent() && installment.getDueDate().isAfter(lastRepaymentDate)) {
|
||||
if ((includeRecalculatedInterestComponent || !installment.isRecalculatedInterestComponent())
|
||||
&& installment.getDueDate().isAfter(lastRepaymentDate)) {
|
||||
lastRepaymentDate = installment.getDueDate();
|
||||
}
|
||||
}
|
||||
@@ -750,7 +751,7 @@ public class Loan extends AbstractPersistable<Long> {
|
||||
validateLoanIsNotClosed(loanCharge);
|
||||
|
||||
// NOTE: to remove this constraint requires that loan transactions
|
||||
// that represent the waive of charges also be removed (or reversed)
|
||||
// that represent the waive of charges also be removed (or reversed)M
|
||||
// if you want ability to remove loan charges that are waived.
|
||||
validateLoanChargeIsNotWaived(loanCharge);
|
||||
|
||||
@@ -1616,7 +1617,7 @@ public class Loan extends AbstractPersistable<Long> {
|
||||
}
|
||||
if (loanCharge.isActive()) {
|
||||
loanCharge.update(chargeAmt, loanCharge.getDueLocalDate(), amount, fetchNumberOfInstallmensAfterExceptions(), totalChargeAmt);
|
||||
validateChargeHasValidSpecifiedDateIfApplicable(loanCharge, getDisbursementDate(), getLastRepaymentPeriodDueDate());
|
||||
validateChargeHasValidSpecifiedDateIfApplicable(loanCharge, getDisbursementDate(), getLastRepaymentPeriodDueDate(false));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -4946,7 +4947,7 @@ public class Loan extends AbstractPersistable<Long> {
|
||||
if (loanSchedule == null) { return; }
|
||||
updateLoanSchedule(loanSchedule.getInstallments(), currentUser);
|
||||
this.interestRecalculatedOn = DateUtils.getDateOfTenant();
|
||||
LocalDate lastRepaymentDate = this.getLastRepaymentPeriodDueDate();
|
||||
LocalDate lastRepaymentDate = this.getLastRepaymentPeriodDueDate(true);
|
||||
Set<LoanCharge> charges = this.charges();
|
||||
for (LoanCharge loanCharge : charges) {
|
||||
if (!loanCharge.isDueAtDisbursement()) {
|
||||
|
||||
Reference in New Issue
Block a user