adamsaghy commented on code in PR #4392:
URL: https://github.com/apache/fineract/pull/4392#discussion_r1978136702
##########
fineract-progressive-loan/src/main/java/org/apache/fineract/portfolio/loanaccount/domain/transactionprocessor/impl/AdvancedPaymentScheduleTransactionProcessor.java:
##########
@@ -2376,11 +2377,21 @@ private void
createMissingAccrualTransactionDuringChargeOffIfNeeded(final BigDec
final BigDecimal missingAccrualAmount =
newInterest.subtract(sumOfAccrualsTillChargeOff);
+ if (missingAccrualAmount.compareTo(BigDecimal.ZERO) == 0) {
+ return;
+ }
+
+ final LoanTransaction newAccrualTransaction;
+
if (missingAccrualAmount.compareTo(BigDecimal.ZERO) > 0) {
- final LoanTransaction newAccrualTransaction =
accrueTransaction(loan, loan.getOffice(), chargeOffDate, missingAccrualAmount,
- missingAccrualAmount, ZERO, ZERO,
externalIdFactory.create());
- loan.addLoanTransaction(newAccrualTransaction);
- loanTransactionRepository.saveAndFlush(newAccrualTransaction);
Review Comment:
This is incorrect.
We should not flush it here, rather we should add it to the
newTransactionMappings of changedTransactionDetail of transaction context!
This way when the transaction is created we also trigger the needed business
external events!
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]