From 3aa01ca5e93bb2760dbf16379dcd1e53a3ef75de Mon Sep 17 00:00:00 2001 From: nkdengineer Date: Fri, 6 Sep 2024 14:48:36 +0700 Subject: [PATCH 1/3] fix: Error Not Triggered for Auto-Filled Report Field --- src/libs/actions/IOU.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libs/actions/IOU.ts b/src/libs/actions/IOU.ts index 29d481737790..68c91493da19 100644 --- a/src/libs/actions/IOU.ts +++ b/src/libs/actions/IOU.ts @@ -885,7 +885,7 @@ function buildOnyxDataForMoneyRequest( } // Show field violations only for control policies - if (PolicyUtils.isControlPolicy(policy)) { + if (PolicyUtils.isControlPolicy(policy) && shouldCreateNewMoneyRequestReport) { const {optimisticData: fieldViolationsOptimisticData, failureData: fieldViolationsFailureData} = getFieldViolationsOnyxData(iouReport); optimisticData.push(...fieldViolationsOptimisticData); failureData.push(...fieldViolationsFailureData); From a7a4f3d1480b9623f525c614eaed4344529c5285 Mon Sep 17 00:00:00 2001 From: nkdengineer Date: Sat, 7 Sep 2024 16:52:25 +0700 Subject: [PATCH 2/3] fix logic add violations --- src/libs/actions/IOU.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libs/actions/IOU.ts b/src/libs/actions/IOU.ts index 68c91493da19..e806416725ae 100644 --- a/src/libs/actions/IOU.ts +++ b/src/libs/actions/IOU.ts @@ -885,7 +885,7 @@ function buildOnyxDataForMoneyRequest( } // Show field violations only for control policies - if (PolicyUtils.isControlPolicy(policy) && shouldCreateNewMoneyRequestReport) { + if (PolicyUtils.isControlPolicy(policy) && !shouldCreateNewMoneyRequestReport) { const {optimisticData: fieldViolationsOptimisticData, failureData: fieldViolationsFailureData} = getFieldViolationsOnyxData(iouReport); optimisticData.push(...fieldViolationsOptimisticData); failureData.push(...fieldViolationsFailureData); From 9faf9895ac8c70c85ac2cc00f66fdcbdb8004525 Mon Sep 17 00:00:00 2001 From: nkdengineer Date: Tue, 10 Sep 2024 01:53:45 +0700 Subject: [PATCH 3/3] remove useless code --- src/libs/actions/IOU.ts | 7 ------- 1 file changed, 7 deletions(-) diff --git a/src/libs/actions/IOU.ts b/src/libs/actions/IOU.ts index 5f1628aac211..fe4e650aeaf9 100644 --- a/src/libs/actions/IOU.ts +++ b/src/libs/actions/IOU.ts @@ -898,13 +898,6 @@ function buildOnyxDataForMoneyRequest( }); } - // Show field violations only for control policies - if (PolicyUtils.isControlPolicy(policy) && !shouldCreateNewMoneyRequestReport) { - const {optimisticData: fieldViolationsOptimisticData, failureData: fieldViolationsFailureData} = getFieldViolationsOnyxData(iouReport); - optimisticData.push(...fieldViolationsOptimisticData); - failureData.push(...fieldViolationsFailureData); - } - return [optimisticData, successData, failureData]; }