From 0943e32cf70f769b062d409819dc2339fcc00763 Mon Sep 17 00:00:00 2001 From: cretadn22 Date: Sun, 24 Nov 2024 16:46:09 +0700 Subject: [PATCH 1/4] hide GBR on pending transactions --- src/libs/ReportUtils.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/libs/ReportUtils.ts b/src/libs/ReportUtils.ts index 952e0c2fe4cc..8ff18dfebfdc 100644 --- a/src/libs/ReportUtils.ts +++ b/src/libs/ReportUtils.ts @@ -2783,8 +2783,11 @@ function getReasonAndReportActionThatRequiresAttention( }; } + const allTransactions = TransactionUtils.getAllReportTransactions(optionOrReport?.reportID); + const hasOnlyPendingTransactions = allTransactions.length > 0 && allTransactions.every((t) => TransactionUtils.isExpensifyCardTransaction(t) && TransactionUtils.isPending(t)); + // Has a child report that is awaiting action (e.g. approve, pay, add bank account) from current user - if (optionOrReport.hasOutstandingChildRequest) { + if (optionOrReport.hasOutstandingChildRequest && !hasOnlyPendingTransactions) return { reason: CONST.REQUIRES_ATTENTION_REASONS.HAS_CHILD_REPORT_AWAITING_ACTION, reportAction: IOU.getIOUReportActionToApproveOrPay(optionOrReport, optionOrReport.reportID), From 19d51670eeec8b19cb55f950fe738ba878095f98 Mon Sep 17 00:00:00 2001 From: cretadn22 Date: Sun, 24 Nov 2024 16:59:35 +0700 Subject: [PATCH 2/4] minor change --- src/libs/ReportUtils.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libs/ReportUtils.ts b/src/libs/ReportUtils.ts index 8ff18dfebfdc..499c4a2c922b 100644 --- a/src/libs/ReportUtils.ts +++ b/src/libs/ReportUtils.ts @@ -2787,7 +2787,7 @@ function getReasonAndReportActionThatRequiresAttention( const hasOnlyPendingTransactions = allTransactions.length > 0 && allTransactions.every((t) => TransactionUtils.isExpensifyCardTransaction(t) && TransactionUtils.isPending(t)); // Has a child report that is awaiting action (e.g. approve, pay, add bank account) from current user - if (optionOrReport.hasOutstandingChildRequest && !hasOnlyPendingTransactions) + if (optionOrReport.hasOutstandingChildRequest && !hasOnlyPendingTransactions) { return { reason: CONST.REQUIRES_ATTENTION_REASONS.HAS_CHILD_REPORT_AWAITING_ACTION, reportAction: IOU.getIOUReportActionToApproveOrPay(optionOrReport, optionOrReport.reportID), From 83f22d69ed271f182985ddad09d74955926e4c24 Mon Sep 17 00:00:00 2001 From: cretadn22 Date: Mon, 25 Nov 2024 21:26:24 +0700 Subject: [PATCH 3/4] update the name --- src/libs/ReportUtils.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/libs/ReportUtils.ts b/src/libs/ReportUtils.ts index 499c4a2c922b..a6243dbb7dbb 100644 --- a/src/libs/ReportUtils.ts +++ b/src/libs/ReportUtils.ts @@ -2783,8 +2783,8 @@ function getReasonAndReportActionThatRequiresAttention( }; } - const allTransactions = TransactionUtils.getAllReportTransactions(optionOrReport?.reportID); - const hasOnlyPendingTransactions = allTransactions.length > 0 && allTransactions.every((t) => TransactionUtils.isExpensifyCardTransaction(t) && TransactionUtils.isPending(t)); + const transactions = TransactionUtils.getAllReportTransactions(optionOrReport?.reportID); + const hasOnlyPendingTransactions = transactions.length > 0 && transactions.every((t) => TransactionUtils.isExpensifyCardTransaction(t) && TransactionUtils.isPending(t)); // Has a child report that is awaiting action (e.g. approve, pay, add bank account) from current user if (optionOrReport.hasOutstandingChildRequest && !hasOnlyPendingTransactions) { From 0bedb0645b14d038527f1b7b48dbb8a7aef31fc5 Mon Sep 17 00:00:00 2001 From: cretadn22 Date: Thu, 12 Dec 2024 00:16:30 +0700 Subject: [PATCH 4/4] get correct transactions --- src/libs/ReportUtils.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/libs/ReportUtils.ts b/src/libs/ReportUtils.ts index e7ccf1a0d466..26d1c4ef5ec8 100644 --- a/src/libs/ReportUtils.ts +++ b/src/libs/ReportUtils.ts @@ -2794,14 +2794,16 @@ function getReasonAndReportActionThatRequiresAttention( }; } - const transactions = TransactionUtils.getAllReportTransactions(optionOrReport?.reportID); + const iouReportActionToApproveOrPay = IOU.getIOUReportActionToApproveOrPay(optionOrReport, optionOrReport.reportID); + const iouReportID = ReportActionsUtils.getIOUReportIDFromReportActionPreview(iouReportActionToApproveOrPay); + const transactions = TransactionUtils.getAllReportTransactions(iouReportID); const hasOnlyPendingTransactions = transactions.length > 0 && transactions.every((t) => TransactionUtils.isExpensifyCardTransaction(t) && TransactionUtils.isPending(t)); // Has a child report that is awaiting action (e.g. approve, pay, add bank account) from current user if (optionOrReport.hasOutstandingChildRequest && !hasOnlyPendingTransactions) { return { reason: CONST.REQUIRES_ATTENTION_REASONS.HAS_CHILD_REPORT_AWAITING_ACTION, - reportAction: IOU.getIOUReportActionToApproveOrPay(optionOrReport, optionOrReport.reportID), + reportAction: iouReportActionToApproveOrPay, }; }