From 513e863bbaaf91535b75bca62932149f1d40502c Mon Sep 17 00:00:00 2001 From: Nitesh Yadav Date: Thu, 6 Aug 2026 15:30:30 +0530 Subject: [PATCH] fix(cashier): skip today's-transactions/standing-instructions calls for Share accounts MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Share accounts have no /accounts/share/{id}/transactions REST sub-resource (transactions come embedded via ?associations=all) and Share isn't a valid standing-instruction source account type on the backend — hitting either endpoint 404s / errors. Restores the txnFetchUnsupported/siFetchUnsupported config flags (present on dev, lost in the earlier dev-merge's silent auto-resolve) that skip both calls for Share, fixing the 404 seen when opening a Share account in Transaction Entry. --- .../transaction-entry.component.ts | 41 ++++++++++++++----- 1 file changed, 30 insertions(+), 11 deletions(-) diff --git a/src/app/cashier/transaction-entry/transaction-entry.component.ts b/src/app/cashier/transaction-entry/transaction-entry.component.ts index d803d8c23..1174f3008 100644 --- a/src/app/cashier/transaction-entry/transaction-entry.component.ts +++ b/src/app/cashier/transaction-entry/transaction-entry.component.ts @@ -1661,6 +1661,17 @@ export class TransactionEntryComponent implements OnInit, OnDestroy { siAccountType: number; txnBase: string; txnSearchSupported: boolean; + /** True when this account type has no separate REST transactions sub-resource at all (e.g. + * Share accounts — Fineract returns transactions embedded on the account detail response + * itself via ?associations=all, never at /accounts/share/{id}/transactions). Skips the + * "today's transactions" HTTP call entirely instead of hitting a 404. */ + txnFetchUnsupported?: boolean; + /** True when this account type has no standing-instruction "from account type" mapping on + * the backend at all (PortfolioAccountType only defines LOAN/SAVINGS/CURRENT — Share isn't + * a valid standing-instruction source account). Skips that HTTP call entirely instead of + * sending an fromAccountType value the backend's query-builder silently can't match, + * which otherwise produces a malformed "WHERE " SQL statement server-side. */ + siFetchUnsupported?: boolean; maxLimit: number; skipGlobalSearch: boolean; listQueryParam: string; @@ -1695,6 +1706,8 @@ export class TransactionEntryComponent implements OnInit, OnDestroy { siAccountType: 4, txnBase: '/accounts/share', txnSearchSupported: false, + txnFetchUnsupported: true, + siFetchUnsupported: true, maxLimit: 500, skipGlobalSearch: true, listQueryParam: 'accountNo', @@ -1807,6 +1820,8 @@ export class TransactionEntryComponent implements OnInit, OnDestroy { siAccountType: number; txnBase: string; txnSearchSupported: boolean; + txnFetchUnsupported?: boolean; + siFetchUnsupported?: boolean; detailParams?: string; }, token: number, @@ -1915,18 +1930,22 @@ export class TransactionEntryComponent implements OnInit, OnDestroy { documents: this.http.get(`/clients/${clientId}/documents`).pipe(catchError(() => of([]))), notes: this.http.get(`/savings/${accountId}/notes`).pipe(catchError(() => of([]))), linkedAcc: this.http.get(`/clients/${clientId}/accounts`).pipe(catchError(() => of(null))), - si: this.http - .get(`/standinginstructions?fromAccountType=${cfg.siAccountType}&fromAccountId=${accountId}&limit=10`) - .pipe(catchError(() => of({ pageItems: [] }))), - todayTxns: cfg.txnSearchSupported - ? this.http - .get( - `${cfg.txnBase}/${accountId}/transactions/search?fromDate=${todayStr}&toDate=${todayStr}&limit=20` - ) - .pipe(catchError(() => of({ pageItems: [] }))) + si: cfg.siFetchUnsupported + ? of({ pageItems: [] }) : this.http - .get(`${cfg.txnBase}/${accountId}/transactions?limit=50`) - .pipe(catchError(() => of({ pageItems: [] }))) + .get(`/standinginstructions?fromAccountType=${cfg.siAccountType}&fromAccountId=${accountId}&limit=10`) + .pipe(catchError(() => of({ pageItems: [] }))), + todayTxns: cfg.txnFetchUnsupported + ? of({ pageItems: [] }) + : cfg.txnSearchSupported + ? this.http + .get( + `${cfg.txnBase}/${accountId}/transactions/search?fromDate=${todayStr}&toDate=${todayStr}&limit=20` + ) + .pipe(catchError(() => of({ pageItems: [] }))) + : this.http + .get(`${cfg.txnBase}/${accountId}/transactions?limit=50`) + .pipe(catchError(() => of({ pageItems: [] }))) }); if (clientIdHint) {