Merge pull request #654 from pramodn02/MIFOSX-766

added reprocess of schedule for add and remove of loan charge
This commit is contained in:
Keith Woodlock
2013-11-02 19:16:10 -07:00
@@ -439,7 +439,8 @@ public class Loan extends AbstractPersistable<Long> {
// transactions // transactions
existingTransactionIds.addAll(findExistingTransactionIds()); existingTransactionIds.addAll(findExistingTransactionIds());
existingReversedTransactionIds.addAll(findExistingReversedTransactionIds()); existingReversedTransactionIds.addAll(findExistingReversedTransactionIds());
final LoanRepaymentScheduleProcessingWrapper wrapper = new LoanRepaymentScheduleProcessingWrapper();
wrapper.reprocess(getCurrency(), getDisbursementDate(), this.repaymentScheduleInstallments, setOfLoanCharges());
if (!loanCharge.isDueAtDisbursement()) { if (!loanCharge.isDueAtDisbursement()) {
final List<LoanTransaction> allNonContraTransactionsPostDisbursement = retreiveListOfTransactionsPostDisbursement(); final List<LoanTransaction> allNonContraTransactionsPostDisbursement = retreiveListOfTransactionsPostDisbursement();
changedTransactionDetail = loanRepaymentScheduleTransactionProcessor.handleTransaction(getDisbursementDate(), changedTransactionDetail = loanRepaymentScheduleTransactionProcessor.handleTransaction(getDisbursementDate(),
@@ -448,10 +449,6 @@ public class Loan extends AbstractPersistable<Long> {
mapEntry.getValue().updateLoan(this); mapEntry.getValue().updateLoan(this);
} }
// this.loanTransactions.addAll(changedTransactionDetail.getNewTransactionMappings().values()); // this.loanTransactions.addAll(changedTransactionDetail.getNewTransactionMappings().values());
} else {
// just reprocess the loan schedule only for now.
final LoanRepaymentScheduleProcessingWrapper wrapper = new LoanRepaymentScheduleProcessingWrapper();
wrapper.reprocess(getCurrency(), getDisbursementDate(), this.repaymentScheduleInstallments, setOfLoanCharges());
} }
updateLoanSummaryDerivedFields(); updateLoanSummaryDerivedFields();
@@ -569,6 +566,8 @@ public class Loan extends AbstractPersistable<Long> {
final boolean removed = setOfLoanCharges().remove(loanCharge); final boolean removed = setOfLoanCharges().remove(loanCharge);
if (removed) { if (removed) {
final LoanRepaymentScheduleProcessingWrapper wrapper = new LoanRepaymentScheduleProcessingWrapper();
wrapper.reprocess(getCurrency(), getDisbursementDate(), this.repaymentScheduleInstallments, setOfLoanCharges());
updateSummaryWithTotalFeeChargesDueAtDisbursement(deriveSumTotalOfChargesDueAtDisbursement()); updateSummaryWithTotalFeeChargesDueAtDisbursement(deriveSumTotalOfChargesDueAtDisbursement());
} }