Skip to content

Commit

Permalink
update pay button condition
Browse files Browse the repository at this point in the history
  • Loading branch information
luacmartins committed Nov 15, 2024
1 parent 9178bd2 commit e12c200
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
5 changes: 4 additions & 1 deletion src/libs/SearchUIUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
3 changes: 1 addition & 2 deletions src/libs/actions/Search.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit e12c200

Please sign in to comment.