adamsaghy commented on code in PR #6457:
URL: https://github.com/apache/fineract/pull/6457#discussion_r4064493028
##########
fineract-working-capital-loan/src/main/java/org/apache/fineract/portfolio/workingcapitalloan/service/WorkingCapitalLoanWritePlatformServiceImpl.java:
##########
@@ -1307,18 +1307,19 @@ private WorkingCapitalLoanTransaction
reverseDisbursementTransactionAndResetBala
final List<WorkingCapitalLoanTransaction> accrualsToReverse =
transactions.stream()
.filter(t -> t.getTypeOf() == LoanTransactionType.ACCRUAL &&
!t.isReversed()).toList();
- transactions.forEach(this::markReversed);
-
- if
(loan.getLoanProduct().getAccountingRule().isAccrualWithDeferredRevenueAmortization())
{
- accountingProcessor.postReversalJournalEntries(loan, txn);
- }
+ transactions.stream().filter(t -> !t.isReversed()) // reverse only
unreversed transaction
+ .peek(this::markReversed) // mark them reversed
+ .forEach(t -> { // post journal entries if accounting is
enabled
+ if
(loan.getLoanProduct().getAccountingRule().isAccrualWithDeferredRevenueAmortization())
{
+ accountingProcessor.postReversalJournalEntries(loan,
t);
+ }
+ });
this.transactionRepository.saveAll(transactions);
this.transactionRepository.flush();
// Reverse the journal entries of any charge accrual so the recognized
income/receivable is backed out with the
// disbursement; marking the transaction reversed alone would leave
the GL postings in place.
- accrualsToReverse.forEach(accrual ->
accountingProcessor.postReversalJournalEntries(loan, accrual));
Review Comment:
Any reason not to do it?
--
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]