From e12c200f036638b9ae7d37e6f5dce2b93b36c6f8 Mon Sep 17 00:00:00 2001 From: Carlos Martins Date: Fri, 15 Nov 2024 15:24:15 -0700 Subject: [PATCH] update pay button condition --- src/libs/SearchUIUtils.ts | 5 ++++- src/libs/actions/Search.ts | 3 +-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/libs/SearchUIUtils.ts b/src/libs/SearchUIUtils.ts index 50389f246a63..d9f63a0c1094 100644 --- a/src/libs/SearchUIUtils.ts +++ b/src/libs/SearchUIUtils.ts @@ -288,7 +288,10 @@ function getAction(data: OnyxTypes.SearchResults['data'], key: string): SearchTr const chatReport = data[`${ONYXKEYS.COLLECTION.REPORT}${report?.chatReportID}`] ?? {}; const chatReportRNVP = data[`${ONYXKEYS.COLLECTION.REPORT_NAME_VALUE_PAIRS}${report?.chatReportID}`] ?? undefined; - if (IOU.canIOUBePaid(report, chatReport, policy, allReportTransactions, false, chatReportRNVP, invoiceReceiverPolicy)) { + if ( + IOU.canIOUBePaid(report, chatReport, policy, allReportTransactions, false, chatReportRNVP, invoiceReceiverPolicy) && + !ReportUtils.hasOnlyHeldExpenses(report.reportID, allReportTransactions) + ) { return CONST.SEARCH.ACTION_TYPES.PAY; } diff --git a/src/libs/actions/Search.ts b/src/libs/actions/Search.ts index 5009645cfb25..82d430f70e99 100644 --- a/src/libs/actions/Search.ts +++ b/src/libs/actions/Search.ts @@ -49,9 +49,8 @@ function handleActionButtonPress(hash: number, item: TransactionListItemType | R const transactionID = isTransactionListItemType(item) ? item.transactionID : undefined; switch (item.action) { - case CONST.SEARCH.ACTION_TYPES.PAY: { + case CONST.SEARCH.ACTION_TYPES.PAY: return getPayActionCallback(hash, item, goToItem); - } case CONST.SEARCH.ACTION_TYPES.APPROVE: return approveMoneyRequestOnSearch(hash, [item.reportID], transactionID); default: