multi tranche loan validation add and foreclose issues for multi tranche issues fixed

This commit is contained in:
venkatconflux
2016-06-22 18:47:56 +05:30
parent c31c46b6d9
commit 91a51698fb
2 changed files with 15 additions and 2 deletions
@@ -6227,7 +6227,13 @@ public class Loan extends AbstractPersistable<Long> {
}
}
for(LoanDisbursementDetails loanDisbursementDetails : getDisbursementDetails()){
if(loanDisbursementDetails.actualDisbursementDate() == null){
totalPrincipal = Money.of(currency, totalPrincipal.getAmount().subtract(loanDisbursementDetails.principal()));
}
}
LocalDate installmentStartDate = getDisbursementDate();
if (newInstallments.size() > 0) {
@@ -33,7 +33,6 @@ import java.util.Set;
import org.apache.commons.lang.StringUtils;
import org.apache.fineract.accounting.journalentry.service.JournalEntryWritePlatformService;
import org.apache.fineract.infrastructure.codes.data.CodeValueData;
import org.apache.fineract.infrastructure.codes.domain.CodeValue;
import org.apache.fineract.infrastructure.codes.domain.CodeValueRepositoryWrapper;
import org.apache.fineract.infrastructure.configuration.domain.ConfigurationDomainService;
@@ -2903,6 +2902,14 @@ public class LoanWritePlatformServiceJpaRepositoryImpl implements LoanWritePlatf
String noteText = this.fromApiJsonHelper.extractStringNamed(LoanApiConstants.noteParamName, element);
LoanRescheduleRequest loanRescheduleRequest = null;
for (LoanDisbursementDetails loanDisbursementDetails : loan.getDisbursementDetails()) {
if (!loanDisbursementDetails.expectedDisbursementDateAsLocalDate().isAfter(transactionDate)
&& loanDisbursementDetails.actualDisbursementDate() == null) {
final String defaultUserMessage = "The loan with undisbrsed tranche before foreclosure cannot be foreclosed.";
throw new LoanForeclosureException("loan.with.undisbursed.tranche.before.foreclosure.cannot.be.foreclosured",
defaultUserMessage, transactionDate);
}
}
this.loanScheduleHistoryWritePlatformService.createAndSaveLoanScheduleArchive(loan.getRepaymentScheduleInstallments(),
loan, loanRescheduleRequest);