adamsaghy commented on code in PR #6235:
URL: https://github.com/apache/fineract/pull/6235#discussion_r3734773311
##########
fineract-provider/src/main/java/org/apache/fineract/portfolio/account/service/StandingInstructionReadPlatformServiceImpl.java:
##########
@@ -299,8 +299,21 @@ public Page<StandingInstructionData> retrieveAll(final
StandingInstructionDTO st
sqlBuilder.append(" fromsavacc.id=? ");
paramObj.add(standingInstructionDTO.fromAccount());
} else if (PortfolioAccountType.LOAN.equals(accountType)) {
- sqlBuilder.append(" fromloanacc.id=? ");
- paramObj.add(standingInstructionDTO.fromAccount());
+ // For LOAN_REPAYMENT transfers, loan is stored in
to_loan_account_id (FROM=SAVINGS, TO=LOAN)
+ // For other transfer types, loan is stored in
from_loan_account_id
+ // Defensive fallback: if transferType is null, check both
columns to handle UI inconsistencies
+ Integer transferTypeValue =
standingInstructionDTO.transferType();
+ if (transferTypeValue != null &&
transferTypeValue.equals(AccountTransferType.LOAN_REPAYMENT.getValue())) {
+ sqlBuilder.append(" toloanacc.id=? ");
Review Comment:
why to use the `standingInstructionDTO.fromAccount()` for `toloanacc.id`?
--
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]