From 07d496d5c3c0766e7d0f52f22f99c0585816959e Mon Sep 17 00:00:00 2001 From: M00rish Date: Tue, 15 Oct 2024 19:12:52 +0200 Subject: [PATCH] adding check for the case when unheldTotal is null --- src/components/ReportActionItem/ReportPreview.tsx | 2 +- src/libs/actions/IOU.ts | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/components/ReportActionItem/ReportPreview.tsx b/src/components/ReportActionItem/ReportPreview.tsx index 4cd0341a2718..3dee942c7a70 100644 --- a/src/components/ReportActionItem/ReportPreview.tsx +++ b/src/components/ReportActionItem/ReportPreview.tsx @@ -344,7 +344,7 @@ function ReportPreview({ const shouldShowSingleRequestMerchantOrDescription = numberOfRequests === 1 && (!!formattedMerchant || !!formattedDescription) && !(hasOnlyTransactionsWithPendingRoutes && !totalDisplaySpend); const shouldShowSubtitle = !isScanning && (shouldShowSingleRequestMerchantOrDescription || numberOfRequests > 1) && !isDisplayAmountZero(getDisplayAmount()); - const shouldShowScanningSubtitle = numberOfScanningReceipts === 1 && numberOfRequests === 1; + const shouldShowScanningSubtitle = (numberOfScanningReceipts === 1 && numberOfRequests === 1) || (numberOfScanningReceipts >= 1 && Number(nonHeldAmount) === 0); const shouldShowPendingSubtitle = numberOfPendingRequests === 1 && numberOfRequests === 1; const isPayAtEndExpense = ReportUtils.isPayAtEndExpenseReport(iouReportID, allTransactions); diff --git a/src/libs/actions/IOU.ts b/src/libs/actions/IOU.ts index 0f974566a98b..eb6100c0187e 100644 --- a/src/libs/actions/IOU.ts +++ b/src/libs/actions/IOU.ts @@ -6969,8 +6969,9 @@ function canApproveIOU(iouReport: OnyxTypes.OnyxInputOrEntry, const iouSettled = ReportUtils.isSettled(iouReport?.reportID); const reportNameValuePairs = ReportUtils.getReportNameValuePairs(iouReport?.reportID); const isArchivedReport = ReportUtils.isArchivedRoom(iouReport, reportNameValuePairs); + const unheldTotalIsZero = iouReport && iouReport.unheldTotal === 0; - return isCurrentUserManager && !isOpenExpenseReport && !isApproved && !iouSettled && !isArchivedReport; + return isCurrentUserManager && !isOpenExpenseReport && !isApproved && !iouSettled && !isArchivedReport && !unheldTotalIsZero; } function canIOUBePaid(