diff --git a/src/libs/ReportUtils.ts b/src/libs/ReportUtils.ts index bb9efc4e39fc..9bea3bd0513b 100644 --- a/src/libs/ReportUtils.ts +++ b/src/libs/ReportUtils.ts @@ -160,6 +160,7 @@ import { hasDependentTags as hasDependentTagsPolicyUtils, hasDynamicExternalWorkflow, isExpensifyTeam, + isGroupPolicy as isGroupPolicyPolicyUtils, isInstantSubmitEnabled, isPaidGroupPolicy as isPaidGroupPolicyPolicyUtils, isPendingDeletePolicy, @@ -2785,7 +2786,7 @@ function canAddTransaction(moneyRequestReport: OnyxEntry, isReportArchiv // This will be fixed as part of https://github.com/Expensify/Expensify/issues/507850 const policy = getPolicy(moneyRequestReport?.policyID); - if (isExpenseReport(moneyRequestReport) && (!isCurrentUserSubmitter(moneyRequestReport) || !isPaidGroupPolicyPolicyUtils(policy))) { + if (isExpenseReport(moneyRequestReport) && (!isCurrentUserSubmitter(moneyRequestReport) || !isGroupPolicyPolicyUtils(policy))) { return false; } diff --git a/tests/actions/IOU/RequestMoneyTest.ts b/tests/actions/IOU/RequestMoneyTest.ts index 6041c90d8dbf..2666fc90de56 100644 --- a/tests/actions/IOU/RequestMoneyTest.ts +++ b/tests/actions/IOU/RequestMoneyTest.ts @@ -118,6 +118,7 @@ jest.mock('@src/libs/SearchQueryUtils', () => { jest.mock('@libs/PolicyUtils', () => ({ ...jest.requireActual('@libs/PolicyUtils'), isPaidGroupPolicy: jest.fn().mockReturnValue(true), + isGroupPolicy: jest.fn().mockReturnValue(true), isPolicyOwner: jest.fn().mockImplementation((policy?: OnyxEntry, currentUserAccountID?: number) => !!currentUserAccountID && policy?.ownerAccountID === currentUserAccountID), })); diff --git a/tests/actions/ReportPreviewActionUtilsTest.ts b/tests/actions/ReportPreviewActionUtilsTest.ts index def1bf292c1f..6606f223a6b2 100644 --- a/tests/actions/ReportPreviewActionUtilsTest.ts +++ b/tests/actions/ReportPreviewActionUtilsTest.ts @@ -43,6 +43,7 @@ jest.mock('@libs/PolicyUtils', () => ({ hasAccountingConnections: jest.fn().mockReturnValue(true), getValidConnectedIntegration: jest.fn().mockReturnValue('netsuite'), isPaidGroupPolicy: jest.fn().mockReturnValue(true), + isGroupPolicy: jest.fn().mockReturnValue(true), })); jest.mock('@src/libs/SearchUIUtils', () => ({ getSuggestedSearches: jest.fn().mockReturnValue({}), diff --git a/tests/unit/ReportSecondaryActionUtilsTest.ts b/tests/unit/ReportSecondaryActionUtilsTest.ts index edccf4f0925e..d94ac268c20f 100644 --- a/tests/unit/ReportSecondaryActionUtilsTest.ts +++ b/tests/unit/ReportSecondaryActionUtilsTest.ts @@ -49,6 +49,7 @@ jest.mock('@libs/PolicyUtils', () => ({ isPolicyAuditor: (...args: Parameters) => jest.requireActual('@libs/PolicyUtils').isPolicyAuditor(...args), getValidConnectedIntegration: jest.fn().mockReturnValue('netsuite'), isPaidGroupPolicy: jest.fn().mockReturnValue(true), + isGroupPolicy: jest.fn().mockReturnValue(true), })); describe('getSecondaryAction', () => { diff --git a/tests/unit/ReportUtilsTest.ts b/tests/unit/ReportUtilsTest.ts index 7e3788b32490..0c977fba6f61 100644 --- a/tests/unit/ReportUtilsTest.ts +++ b/tests/unit/ReportUtilsTest.ts @@ -263,6 +263,7 @@ jest.mock('@libs/PolicyUtils', () => ({ ...jest.requireActual('@libs/PolicyUtils'), isPolicyAdmin: jest.fn().mockImplementation((policy?: Policy) => policy?.role === 'admin'), isPaidGroupPolicy: jest.fn().mockImplementation((policy?: Policy) => policy?.type === 'corporate' || policy?.type === 'team'), + isGroupPolicy: jest.fn().mockImplementation((policy?: Policy) => policy?.type === 'corporate' || policy?.type === 'team' || policy?.type === 'submit2026'), isPolicyOwner: jest.fn().mockImplementation((policy?: Policy, currentUserAccountID?: number) => !!currentUserAccountID && policy?.ownerAccountID === currentUserAccountID), })); @@ -3906,6 +3907,7 @@ describe('ReportUtils', () => { ownerAccountID: currentUserAccountID, }; mockedPolicyUtils.isPaidGroupPolicy.mockReturnValue(true); + mockedPolicyUtils.isGroupPolicy.mockReturnValue(true); const moneyRequestOptions = temporary_getMoneyRequestOptions(report, undefined, [currentUserAccountID], [CONST.BETAS.ALL]); expect(moneyRequestOptions.length).toBe(2); expect(moneyRequestOptions.includes(CONST.IOU.TYPE.SUBMIT)).toBe(true); @@ -8723,6 +8725,7 @@ describe('ReportUtils', () => { await Onyx.set(`${ONYXKEYS.COLLECTION.REPORT}${report.reportID}`, report); mockedPolicyUtils.isPaidGroupPolicy.mockReturnValue(true); + mockedPolicyUtils.isGroupPolicy.mockReturnValue(true); // When it's checked if the transactions can be added // Simulate how components determined if a report is archived by using this hook @@ -8789,6 +8792,7 @@ describe('ReportUtils', () => { const {result: isReportArchived} = renderHook(() => useReportIsArchived(report?.reportID)); mockedPolicyUtils.isPaidGroupPolicy.mockReturnValue(true); + mockedPolicyUtils.isGroupPolicy.mockReturnValue(true); // If the canAddTransaction is used for the case of adding expense into the report const result = canAddTransaction(report, isReportArchived.current);