From 4fc1ab628cb8aa82184a410f0d1bc3dc44e6d534 Mon Sep 17 00:00:00 2001 From: mkzie2 Date: Wed, 14 Jan 2026 23:27:14 +0700 Subject: [PATCH 1/3] fix: report can be selected on confirm page --- src/libs/ReportUtils.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/libs/ReportUtils.ts b/src/libs/ReportUtils.ts index f15613ff14ef4..95776c4009452 100644 --- a/src/libs/ReportUtils.ts +++ b/src/libs/ReportUtils.ts @@ -11324,7 +11324,8 @@ function isReportOutstanding( const activeReport = allReports?.[`${ONYXKEYS.COLLECTION.REPORT}${params?.reportID}`]; const policy = allPolicies?.[`${ONYXKEYS.COLLECTION.POLICY}${policyID}`]; const reportNameValuePair = reportNameValuePairs?.[`${ONYXKEYS.COLLECTION.REPORT_NAME_VALUE_PAIRS}${iouReport.reportID}`]; - const shouldAllowSubmittedReport = allowSubmitted || isInstantSubmitEnabled(policy) || isProcessingReport(activeReport); + const canSubmit = canSubmitReport(iouReport, policy, getReportTransactions(iouReport.reportID), undefined, false, currentUserEmail ?? ''); + const shouldAllowSubmittedReport = allowSubmitted || canSubmit || isProcessingReport(activeReport); return ( isExpenseReport(iouReport) && iouReport?.stateNum !== undefined && From 7cd88607674efbb06832dce55a3393ec4a699317 Mon Sep 17 00:00:00 2001 From: mkzie2 Date: Mon, 26 Jan 2026 21:13:52 +0700 Subject: [PATCH 2/3] fix: apply suggestions --- src/libs/ReportUtils.ts | 35 ++++++++++++++++++++--------------- 1 file changed, 20 insertions(+), 15 deletions(-) diff --git a/src/libs/ReportUtils.ts b/src/libs/ReportUtils.ts index 4fc3470915e8e..e0ad83550f8c0 100644 --- a/src/libs/ReportUtils.ts +++ b/src/libs/ReportUtils.ts @@ -11359,26 +11359,31 @@ function isReportOutstanding( reportNameValuePairs: OnyxCollection = allReportNameValuePair, allowSubmitted = true, ): boolean { - if (!iouReport || isEmptyObject(iouReport)) { + if ( + !iouReport || + isEmptyObject(iouReport) || + !isExpenseReport(iouReport) || + iouReport?.stateNum === undefined || + iouReport?.statusNum === undefined || + iouReport?.policyID !== policyID || + hasForwardedAction(iouReport.reportID) + ) { + return false; + } + const reportNameValuePair = reportNameValuePairs?.[`${ONYXKEYS.COLLECTION.REPORT_NAME_VALUE_PAIRS}${iouReport.reportID}`]; + if (isArchivedReport(reportNameValuePair)) { return false; } const currentRoute = navigationRef.getCurrentRoute(); const params = currentRoute?.params as MoneyRequestNavigatorParamList[typeof SCREENS.MONEY_REQUEST.STEP_CONFIRMATION] | ReportsSplitNavigatorParamList[typeof SCREENS.REPORT]; const activeReport = allReports?.[`${ONYXKEYS.COLLECTION.REPORT}${params?.reportID}`]; - const policy = allPolicies?.[`${ONYXKEYS.COLLECTION.POLICY}${policyID}`]; - const reportNameValuePair = reportNameValuePairs?.[`${ONYXKEYS.COLLECTION.REPORT_NAME_VALUE_PAIRS}${iouReport.reportID}`]; - const canSubmit = canSubmitReport(iouReport, policy, getReportTransactions(iouReport.reportID), undefined, false, currentUserEmail ?? ''); - const shouldAllowSubmittedReport = allowSubmitted || canSubmit || isProcessingReport(activeReport); - return ( - isExpenseReport(iouReport) && - iouReport?.stateNum !== undefined && - iouReport?.statusNum !== undefined && - iouReport?.policyID === policyID && - (shouldAllowSubmittedReport ? iouReport?.stateNum <= CONST.REPORT.STATE_NUM.SUBMITTED : iouReport?.stateNum < CONST.REPORT.STATE_NUM.SUBMITTED) && - (shouldAllowSubmittedReport ? iouReport?.statusNum <= CONST.REPORT.STATE_NUM.SUBMITTED : iouReport?.statusNum < CONST.REPORT.STATE_NUM.SUBMITTED) && - !hasForwardedAction(iouReport.reportID) && - !isArchivedReport(reportNameValuePair) - ); + if (allowSubmitted || isProcessingReport(activeReport)) { + return iouReport.stateNum <= CONST.REPORT.STATE_NUM.SUBMITTED && iouReport.statusNum <= CONST.REPORT.STATE_NUM.SUBMITTED; + } + if (canAddTransaction(iouReport, false, false)) { + return iouReport.stateNum <= CONST.REPORT.STATE_NUM.SUBMITTED && iouReport.statusNum <= CONST.REPORT.STATE_NUM.SUBMITTED; + } + return iouReport.stateNum < CONST.REPORT.STATE_NUM.SUBMITTED && iouReport.statusNum < CONST.REPORT.STATE_NUM.SUBMITTED; } /** From ca9e676bf55bbe6ef2968b3a871db672c5278b7d Mon Sep 17 00:00:00 2001 From: mkzie2 Date: Tue, 27 Jan 2026 17:56:42 +0700 Subject: [PATCH 3/3] fix: apply suggestions --- src/libs/ReportUtils.ts | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/libs/ReportUtils.ts b/src/libs/ReportUtils.ts index 7e0d355ef7fd0..a7dd3b80ba40e 100644 --- a/src/libs/ReportUtils.ts +++ b/src/libs/ReportUtils.ts @@ -11373,10 +11373,7 @@ function isReportOutstanding( const currentRoute = navigationRef.getCurrentRoute(); const params = currentRoute?.params as MoneyRequestNavigatorParamList[typeof SCREENS.MONEY_REQUEST.STEP_CONFIRMATION] | ReportsSplitNavigatorParamList[typeof SCREENS.REPORT]; const activeReport = allReports?.[`${ONYXKEYS.COLLECTION.REPORT}${params?.reportID}`]; - if (allowSubmitted || isProcessingReport(activeReport)) { - return iouReport.stateNum <= CONST.REPORT.STATE_NUM.SUBMITTED && iouReport.statusNum <= CONST.REPORT.STATE_NUM.SUBMITTED; - } - if (canAddTransaction(iouReport, false, false)) { + if (allowSubmitted || isProcessingReport(activeReport) || canAddTransaction(iouReport, false, false)) { return iouReport.stateNum <= CONST.REPORT.STATE_NUM.SUBMITTED && iouReport.statusNum <= CONST.REPORT.STATE_NUM.SUBMITTED; } return iouReport.stateNum < CONST.REPORT.STATE_NUM.SUBMITTED && iouReport.statusNum < CONST.REPORT.STATE_NUM.SUBMITTED;