adamsaghy commented on code in PR #2882:
URL: https://github.com/apache/fineract/pull/2882#discussion_r1073679864


##########
fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/domain/Loan.java:
##########
@@ -6301,26 +6307,27 @@ public Map<String, Object> 
undoLastDisbursal(ScheduleGeneratorDTO scheduleGenera
             List<Long> existingReversedTransactionIds, Loan loan) {
 
         validateAccountStatus(LoanEvent.LOAN_DISBURSAL_UNDO_LAST);
-        existingTransactionIds.addAll(findExistingTransactionIds());
-        
existingReversedTransactionIds.addAll(findExistingReversedTransactionIds());
-        final Map<String, Object> actualChanges = new LinkedHashMap<>();
         
validateActivityNotBeforeClientOrGroupTransferDate(LoanEvent.LOAN_DISBURSAL_UNDO_LAST,
 getDisbursementDate());
-        LocalDate actualDisbursementDate = null;
-        LocalDate lastTransactionDate = getDisbursementDate();
-        List<LoanTransaction> loanTransactions = 
retrieveListOfTransactionsExcludeAccruals();
+
+        final Map<String, Object> actualChanges = new LinkedHashMap<>();
+        List<LoanTransaction> loanTransactions = 
retrieveListOfTransactionsByType(LoanTransactionType.DISBURSEMENT);
+        loanTransactions.sort(Comparator.comparing(LoanTransaction::getId));
+        final LoanTransaction lastDisbursalTransaction = 
loanTransactions.get(loanTransactions.size() - 1);

Review Comment:
   This might not be true. There could be Accrual transaction or any other one 
as well.
   Please make it sure you understand what the legacy logic was doing and not 
do any regression!



-- 
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]

Reply via email to