[
https://issues.apache.org/jira/browse/FINERACT-2728?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Foo Developer updated FINERACT-2728:
------------------------------------
Description:
---
Summary of the bug:
When the office-specific-products-enabled global configuration flag is
enabled, charges returned by various API endpoints were not filtered by office
mapping. This created two
classes of inconsistency:
1. Charge visibility not scoped to office — the charges listing and
charge-selection dropdowns (for loan accounts, savings accounts, share
products, and deposit accounts)
returned all charges system-wide, ignoring the entity mapping that controls
which charges are visible to a given office. Only loan products respected the
office-specific-products-enabled flag; charges did not.
2. Loan template filtered by user's office instead of client's office — when
opening a loan application for a client belonging to a child branch, the loan
product and charge
dropdowns were filtered based on the logged-in user's office, not the
selected client's office. A parent-branch user creating a loan for a
child-branch client would see products
and charges mapped to the parent branch rather than the client's actual
branch.
Root cause:
ChargeReadPlatformServiceImpl did not call FineractEntityAccessUtil to inject
an office-scoped SQL clause, unlike LoanProductReadPlatformServiceImpl. The
loans/template endpoint
passed null as the officeId when fetching products/charges for a client, so
the user's office was resolved instead of the client's.
Fix:
- Extended ChargeReadPlatformService and ChargeReadPlatformServiceImpl with
office-aware overloads for all charge retrieval methods (clients, loan
fees/penalties, savings,
shares, deposits).
- Updated ClientChargesApiResource, LoansApiResource,
LoanReadPlatformServiceImpl, SavingsAccountTemplateReadPlatformServiceImpl,
DepositAccountReadPlatformServiceImpl, and
ShareAccountReadPlatformServiceImpl to pass the relevant officeId through to
the charge queries.
- Added getSQLQueryInClauseIDList_ForChargesVisibleToOffice to
FineractEntityAccessReadService and its implementation.
- Fixed loans/template to resolve the client's office and pass it as officeId
when fetching loan products and charges, so filtering reflects the client's
branch rather than the
logged-in user's.
> [Entity Mapping] Apply Office-Based Charge Filtering Logic for Charges
> (Aligned with Loan Products Behavior)
> ------------------------------------------------------------------------------------------------------------
>
> Key: FINERACT-2728
> URL: https://issues.apache.org/jira/browse/FINERACT-2728
> Project: Apache Fineract
> Issue Type: Bug
> Components: Charges, System
> Reporter: Foo Developer
> Assignee: Foo Developer
> Priority: Major
>
> ---
>
>
> Summary of the bug:
>
>
>
>
>
> When the office-specific-products-enabled global configuration flag is
> enabled, charges returned by various API endpoints were not filtered by
> office mapping. This created two
> classes of inconsistency:
>
>
>
>
>
> 1. Charge visibility not scoped to office — the charges listing and
> charge-selection dropdowns (for loan accounts, savings accounts, share
> products, and deposit accounts)
> returned all charges system-wide, ignoring the entity mapping that controls
> which charges are visible to a given office. Only loan products respected the
>
> office-specific-products-enabled flag; charges did not.
>
>
> 2. Loan template filtered by user's office instead of client's office —
> when opening a loan application for a client belonging to a child branch, the
> loan product and charge
> dropdowns were filtered based on the logged-in user's office, not the
> selected client's office. A parent-branch user creating a loan for a
> child-branch client would see products
> and charges mapped to the parent branch rather than the client's actual
> branch.
>
>
>
>
> Root cause:
>
>
>
>
>
> ChargeReadPlatformServiceImpl did not call FineractEntityAccessUtil to
> inject an office-scoped SQL clause, unlike
> LoanProductReadPlatformServiceImpl. The loans/template endpoint
> passed null as the officeId when fetching products/charges for a client, so
> the user's office was resolved instead of the client's.
>
>
> Fix:
>
>
>
>
>
> - Extended ChargeReadPlatformService and ChargeReadPlatformServiceImpl with
> office-aware overloads for all charge retrieval methods (clients, loan
> fees/penalties, savings,
> shares, deposits).
>
>
> - Updated ClientChargesApiResource, LoansApiResource,
> LoanReadPlatformServiceImpl, SavingsAccountTemplateReadPlatformServiceImpl,
> DepositAccountReadPlatformServiceImpl, and
> ShareAccountReadPlatformServiceImpl to pass the relevant officeId through
> to the charge queries.
>
> - Added getSQLQueryInClauseIDList_ForChargesVisibleToOffice to
> FineractEntityAccessReadService and its implementation.
>
> - Fixed loans/template to resolve the client's office and pass it as
> officeId when fetching loan products and charges, so filtering reflects the
> client's branch rather than the
> logged-in user's.
>
>
>
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
