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) {