AnvayKharb commented on code in PR #6211:
URL: https://github.com/apache/fineract/pull/6211#discussion_r3705950203
##########
fineract-provider/src/main/java/org/apache/fineract/portfolio/search/service/SearchReadServiceImpl.java:
##########
@@ -152,13 +163,54 @@ public String searchSchema(final SearchConditions
searchConditions) {
g.id as entityId, g.display_name as entityName, \
g.external_id as entityExternalId, g.account_no as
entityAccountNo, \
g.office_id as parentId, o.name as parentName, null as
entityMobileNo, \
- g.status_enum as entityStatusEnum, null as subEntityType, null
as parentType \
+ g.status_enum as entityStatusEnum, null as subEntityType, null
as parentType, \
+ null as transactionId, null as transactionType, null as
transactionExternalId, null as transactionRefNo, \
+ null as accountId, null as accountNo, null as accountType \
from m_group g join m_office o on o.id = g.office_id \
where o.hierarchy like :hierarchy \
and (g.account_no like :search or g.display_name like :search \
or g.external_id like :search)) \
order by g.id desc)""";
+ final String loanTransactionMatchSql = """
+ ( (select 'LOAN_TRANSACTION' as entityType, l.id as entityId,
pl.name as entityName, \
+ lt.external_id as entityExternalId, l.account_no as
entityAccountNo, \
+ coalesce(c.id,g.id) as parentId,
coalesce(c.display_name,g.display_name) as parentName, \
+ null as entityMobileNo, l.loan_status_id as entityStatusEnum,
null as subEntityType, \
+ CASE WHEN g.id is null THEN 'client' ELSE 'group' END as
parentType, \
+ lt.id as transactionId, 'repayment' as transactionType,
lt.external_id as transactionExternalId, \
+ null as transactionRefNo, l.id as accountId, l.account_no as
accountNo, 'loan' as accountType \
+ from m_loan_transaction lt join m_loan l on l.id = lt.loan_id \
+ left join m_client c on l.client_id = c.id \
+ left join m_group g ON l.group_id = g.id \
+ left join m_office o on o.id = coalesce(c.office_id,
g.office_id) \
+ left join m_product_loan pl on pl.id=l.product_id \
+ where o.hierarchy like :hierarchy \
+ and lt.transaction_type_enum = 2 \
Review Comment:
Hi @adamsaghy Thanks for pointing this out. I’ve updated the search SQL to
avoid hardcoded transaction type enum values.
The loan transaction search now uses `LoanTransactionType.REPAYMENT`, and
savings transaction search uses `SavingsAccountTransactionType.DEPOSIT` and
`SavingsAccountTransactionType.WITHDRAWAL` as named SQL parameters.
The search scope is unchanged: loan repayments, savings deposits, and
savings withdrawals only.
--
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]