From 6c305cee784f6404e372c13dd93db4bde979251a Mon Sep 17 00:00:00 2001 From: Alberto Date: Wed, 24 Jan 2024 11:43:57 +0100 Subject: [PATCH 1/3] Add approval mode for policies --- src/CONST.ts | 8 ++++++++ src/types/onyx/Policy.ts | 3 +++ tests/utils/LHNTestUtils.js | 1 + tests/utils/collections/policies.ts | 1 + 4 files changed, 13 insertions(+) diff --git a/src/CONST.ts b/src/CONST.ts index 5fee60e57617..29527abf3111 100755 --- a/src/CONST.ts +++ b/src/CONST.ts @@ -1305,6 +1305,14 @@ const CONST = { LAST_BUSINESS_DAY_OF_MONTH: 'lastBusinessDayOfMonth', LAST_DAY_OF_MONTH: 'lastDayOfMonth', }, + APPROVAL_MODE: { + OPTIONAL: 'OPTIONAL', + BASIC: 'BASIC', + ADVANCED: 'ADVANCED', + DYNAMICEXTERNAL: 'DYNAMIC_EXTERNAL', + SMARTREPORT: 'SMARTREPORT', + BILLCOM: 'BILLCOM', + }, ROOM_PREFIX: '#', CUSTOM_UNIT_RATE_BASE_OFFSET: 100, OWNER_EMAIL_FAKE: '_FAKE_', diff --git a/src/types/onyx/Policy.ts b/src/types/onyx/Policy.ts index 97e6597c6444..b56e4b05aba8 100644 --- a/src/types/onyx/Policy.ts +++ b/src/types/onyx/Policy.ts @@ -118,6 +118,9 @@ type Policy = { /** Informative messages about which policy members were added with primary logins when invited with their secondary login */ primaryLoginsInvited?: Record; + + /** The approval mode set up on this policy */ + approvalMode?: string; }; export default Policy; diff --git a/tests/utils/LHNTestUtils.js b/tests/utils/LHNTestUtils.js index 67831bd32bca..6c72558e5df3 100644 --- a/tests/utils/LHNTestUtils.js +++ b/tests/utils/LHNTestUtils.js @@ -262,6 +262,7 @@ function getFakePolicy(id = 1, name = 'Workspace-Test-001') { submitsTo: 123456, defaultBillable: false, disabledFields: {defaultBillable: true, reimbursable: false}, + approvalMode: 'BASIC', }; } diff --git a/tests/utils/collections/policies.ts b/tests/utils/collections/policies.ts index acdd22253173..8547c171c7a7 100644 --- a/tests/utils/collections/policies.ts +++ b/tests/utils/collections/policies.ts @@ -26,5 +26,6 @@ export default function createRandomPolicy(index: number): Policy { errors: {}, customUnits: {}, errorFields: {}, + approvalMode: rand(Object.values(CONST.POLICY.APPROVAL_MODE)), }; } From 7734c9a52f7742d3450d1c29b89c84f7ff44c2d8 Mon Sep 17 00:00:00 2001 From: Alberto Date: Wed, 24 Jan 2024 11:56:12 +0100 Subject: [PATCH 2/3] stricter --- src/types/onyx/Policy.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/types/onyx/Policy.ts b/src/types/onyx/Policy.ts index b56e4b05aba8..9e6af632353e 100644 --- a/src/types/onyx/Policy.ts +++ b/src/types/onyx/Policy.ts @@ -120,7 +120,7 @@ type Policy = { primaryLoginsInvited?: Record; /** The approval mode set up on this policy */ - approvalMode?: string; + approvalMode?: ValueOf; }; export default Policy; From c5ba73717fb3c1c8d5d4b4e80459840d171bbb4a Mon Sep 17 00:00:00 2001 From: Alberto Date: Wed, 24 Jan 2024 12:03:08 +0100 Subject: [PATCH 3/3] prettier --- src/types/onyx/Policy.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/types/onyx/Policy.ts b/src/types/onyx/Policy.ts index 9e6af632353e..2d8bbb7924bd 100644 --- a/src/types/onyx/Policy.ts +++ b/src/types/onyx/Policy.ts @@ -120,7 +120,7 @@ type Policy = { primaryLoginsInvited?: Record; /** The approval mode set up on this policy */ - approvalMode?: ValueOf; + approvalMode?: ValueOf; }; export default Policy;