Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/CONST/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3114,6 +3114,7 @@ const CONST = {
ARE_RULES_ENABLED: 'areRulesEnabled',
ARE_PER_DIEM_RATES_ENABLED: 'arePerDiemRatesEnabled',
IS_ATTENDEE_TRACKING_ENABLED: 'isAttendeeTrackingEnabled',
REQUIRE_COMPANY_CARDS_ENABLED: 'requireCompanyCardsEnabled',
},
DEFAULT_CATEGORIES: {
ADVERTISING: 'Advertising',
Expand Down Expand Up @@ -5727,6 +5728,7 @@ const CONST = {
HOLD: 'hold',
RECEIPT_GENERATED_WITH_AI: 'receiptGeneratedWithAI',
OVER_TRIP_LIMIT: 'overTripLimit',
COMPANY_CARD_REQUIRED: 'companyCardRequired',
},
RTER_VIOLATION_TYPES: {
BROKEN_CARD_CONNECTION: 'brokenCardConnection',
Expand Down
10 changes: 10 additions & 0 deletions src/components/ReportActionItem/MoneyRequestView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import {Str} from 'expensify-common';
import React, {useCallback, useContext, useEffect, useMemo, useState} from 'react';
import {View} from 'react-native';
import type {OnyxCollection, OnyxEntry} from 'react-native-onyx';
import DotIndicatorMessage from '@components/DotIndicatorMessage';
import Icon from '@components/Icon';
import MenuItem from '@components/MenuItem';
import MenuItemWithTopDescription from '@components/MenuItemWithTopDescription';
Expand Down Expand Up @@ -361,6 +362,7 @@ function MoneyRequestView({
const {unit, rate} = DistanceRequestUtils.getRate({transaction: updatedTransaction ?? transaction, policy});
const distance = getDistanceInMeters(transactionBackup ?? updatedTransaction ?? transaction, unit);
const currency = transactionCurrency ?? CONST.CURRENCY.USD;
const hasRequiredCompanyCardViolation = transactionViolations.some((violation) => violation.name === CONST.VIOLATIONS.COMPANY_CARD_REQUIRED);
const isCustomUnitOutOfPolicy = transactionViolations.some((violation) => violation.name === CONST.VIOLATIONS.CUSTOM_UNIT_OUT_OF_POLICY) || (isDistanceRequest && !rate);
let rateToDisplay = isCustomUnitOutOfPolicy ? translate('common.rateOutOfPolicy') : DistanceRequestUtils.getRateForDisplay(unit, rate, currency, translate, toLocaleDigit, isOffline);
const distanceToDisplay = DistanceRequestUtils.getDistanceForDisplay(hasRoute, distance, unit, rate, translate);
Expand Down Expand Up @@ -1068,6 +1070,14 @@ function MoneyRequestView({
}}
/>
)}

{hasRequiredCompanyCardViolation && (
<DotIndicatorMessage
type="error"
style={[styles.mv3, styles.mh4]}
messages={{error: translate('violations.companyCardRequired')}}
/>
)}
</>
</View>
);
Expand Down
1 change: 1 addition & 0 deletions src/hooks/useViolations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ const violationNameToField: Record<ViolationName, (violation: TransactionViolati
taxRequired: () => 'tax',
hold: () => 'none',
receiptGeneratedWithAI: () => 'receipt',
companyCardRequired: () => 'none',
};

type ViolationsMap = Map<ViolationField, TransactionViolation[]>;
Expand Down
3 changes: 3 additions & 0 deletions src/languages/de.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6212,6 +6212,8 @@ Fordere Spesendetails wie Belege und Beschreibungen an, lege Limits und Standard
gambling: 'Glücksspiel',
tobacco: 'Tabak',
adultEntertainment: 'Unterhaltung für Erwachsene',
requireCompanyCard: 'Firmenkarten für alle Einkäufe erforderlich machen',
requireCompanyCardDescription: 'Kennzeichnen Sie alle Barausgaben, einschließlich Kilometer- und Tagegeldspesen.',
},
expenseReportRules: {
title: 'Fortgeschritten',
Expand Down Expand Up @@ -7384,6 +7386,7 @@ Fordere Spesendetails wie Belege und Beschreibungen an, lege Limits und Standard
confirmDuplicatesInfo: `Die Duplikate, die du nicht behältst, werden für die einreichende Person zurückgehalten, damit sie sie löschen kann.`,
hold: 'Diese Ausgabe wurde zurückgestellt',
resolvedDuplicates: 'Duplikat behoben',
companyCardRequired: 'Firmenkartenkäufe erforderlich',
},
reportViolations: {
[CONST.REPORT_VIOLATIONS.FIELD_REQUIRED]: ({fieldName}: RequiredFieldParams) => `${fieldName} ist erforderlich`,
Expand Down
3 changes: 3 additions & 0 deletions src/languages/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6068,6 +6068,8 @@ const translations = {
gambling: 'Gambling',
tobacco: 'Tobacco',
adultEntertainment: 'Adult entertainment',
requireCompanyCard: 'Require company cards for all purchases',
requireCompanyCardDescription: 'Flag all cash spend, including mileage and per-diem expenses.',
},
expenseReportRules: {
title: 'Advanced',
Expand Down Expand Up @@ -7241,6 +7243,7 @@ const translations = {
confirmDuplicatesInfo: `The duplicates you don't keep will be held for the submitter to delete.`,
hold: 'This expense was put on hold',
resolvedDuplicates: 'resolved the duplicate',
companyCardRequired: 'Company card purchases required',
},
reportViolations: {
[CONST.REPORT_VIOLATIONS.FIELD_REQUIRED]: ({fieldName}: RequiredFieldParams) => `${fieldName} is required`,
Expand Down
3 changes: 3 additions & 0 deletions src/languages/es.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5725,6 +5725,8 @@ ${amount} para ${merchant} - ${date}`,
gambling: 'Juegos de apuestas',
tobacco: 'Tabaco',
adultEntertainment: 'Entretenimiento para adultos',
requireCompanyCard: 'Requerir que todas las compras se hagan con la tarjeta de empresa',
requireCompanyCardDescription: 'Marca todo gasto en efectivo, incluyendo kilometraje y gastos per diem.',
},
expenseReportRules: {
title: 'Avanzado',
Expand Down Expand Up @@ -7331,6 +7333,7 @@ ${amount} para ${merchant} - ${date}`,
confirmDuplicatesInfo: 'Los duplicados que no conserves se mantendrán para que el remitente los elimine.',
hold: 'Este gasto está retenido',
resolvedDuplicates: 'resolvió el duplicado',
companyCardRequired: 'Se requieren compras con la tarjeta de la empresa.',
},
reportViolations: {
[CONST.REPORT_VIOLATIONS.FIELD_REQUIRED]: ({fieldName}) => `${fieldName} es obligatorio`,
Expand Down
5 changes: 4 additions & 1 deletion src/languages/fr.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6218,7 +6218,9 @@ Exigez des informations de dépense comme les reçus et les descriptions, défin
hotelIncidentals: 'Frais annexes d’hôtel',
gambling: 'Jeux d’argent',
tobacco: 'Tabac',
adultEntertainment: 'Divertissements pour adultes',
adultEntertainment: 'Divertissement pour adultes',
requireCompanyCard: 'Exiger des cartes d’entreprise pour tous les achats',
requireCompanyCardDescription: 'Marquez toutes les dépenses payées en espèces, y compris les frais kilométriques et les indemnités journalières.',
},
expenseReportRules: {
title: 'Avancé',
Expand Down Expand Up @@ -7392,6 +7394,7 @@ Exigez des informations de dépense comme les reçus et les descriptions, défin
confirmDuplicatesInfo: `Les doublons que vous ne conservez pas seront mis de côté pour que l’expéditeur les supprime.`,
hold: 'Cette dépense a été mise en attente',
resolvedDuplicates: 'a résolu le doublon',
companyCardRequired: 'Achats avec carte d’entreprise requis',
},
reportViolations: {
[CONST.REPORT_VIOLATIONS.FIELD_REQUIRED]: ({fieldName}: RequiredFieldParams) => `${fieldName} est requis`,
Expand Down
11 changes: 7 additions & 4 deletions src/languages/it.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2716,11 +2716,11 @@ ${amount} per ${merchant} - ${date}`,
dedent(`
Collega ${integrationName === CONST.ONBOARDING_ACCOUNTING_MAPPING.other ? 'il tuo' : 'a'} ${integrationName} per la codifica automatica delle spese e la sincronizzazione che rendono la chiusura di fine mese semplicissima.

1. Fai clic su *Workspaces*.
2. Seleziona il tuo workspace.
3. Fai clic su *Accounting*.
1. Fai clic su *Spazi di lavoro*.
2. Seleziona il tuo spazio di lavoro.
3. Fai clic su *Contabilità*.
4. Trova ${integrationName}.
5. Fai clic su *Connect*.
5. Fai clic su *Connetti*.

${
integrationName && CONST.connectionsVideoPaths[integrationName]
Expand Down Expand Up @@ -6190,6 +6190,8 @@ Richiedi dettagli di spesa come ricevute e descrizioni, imposta limiti e valori
gambling: "Gioco d'azzardo",
tobacco: 'Tabacco',
adultEntertainment: 'Intrattenimento per adulti',
requireCompanyCard: 'Richiedi carte aziendali per tutti gli acquisti',
requireCompanyCardDescription: 'Contrassegna tutte le spese in contanti, incluse le spese per chilometraggio e le diarie.',
},
expenseReportRules: {
title: 'Avanzato',
Expand Down Expand Up @@ -7365,6 +7367,7 @@ Richiedi dettagli di spesa come ricevute e descrizioni, imposta limiti e valori
confirmDuplicatesInfo: `I duplicati che non mantieni saranno conservati per consentire al mittente di eliminarli.`,
hold: 'Questa spesa è stata messa in sospeso',
resolvedDuplicates: 'ha risolto il duplicato',
companyCardRequired: 'Acquisti con carta aziendale obbligatori',
},
reportViolations: {
[CONST.REPORT_VIOLATIONS.FIELD_REQUIRED]: ({fieldName}: RequiredFieldParams) => `${fieldName} è obbligatorio`,
Expand Down
3 changes: 3 additions & 0 deletions src/languages/ja.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6153,6 +6153,8 @@ ${reportName}
gambling: 'ギャンブル',
tobacco: 'たばこ',
adultEntertainment: 'アダルトエンターテインメント',
requireCompanyCard: 'すべての購入に会社カードを必須にする',
requireCompanyCardDescription: 'マイレージや日当の経費を含む、すべての現金支出にフラグを付けます。',
},
expenseReportRules: {
title: '上級',
Expand Down Expand Up @@ -7314,6 +7316,7 @@ ${reportName}
confirmDuplicatesInfo: `あなたが保持しない重複分は、申請者が削除できるように保留されます。`,
hold: 'この経費は保留になっています',
resolvedDuplicates: '重複を解決しました',
companyCardRequired: '法人カードでの購入が必須',
},
reportViolations: {
[CONST.REPORT_VIOLATIONS.FIELD_REQUIRED]: ({fieldName}: RequiredFieldParams) => `${fieldName} は必須です`,
Expand Down
3 changes: 3 additions & 0 deletions src/languages/nl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6178,6 +6178,8 @@ Vraag verplichte uitgavedetails zoals bonnetjes en beschrijvingen, stel limieten
gambling: 'Gokken',
tobacco: 'Tabak',
adultEntertainment: 'Volwassenenentertainment',
requireCompanyCard: 'Bedrijfskaarten vereisen voor alle aankopen',
requireCompanyCardDescription: 'Markeer alle contante uitgaven, inclusief kilometer- en dagvergoedingen.',
},
expenseReportRules: {
title: 'Geavanceerd',
Expand Down Expand Up @@ -7350,6 +7352,7 @@ Vraag verplichte uitgavedetails zoals bonnetjes en beschrijvingen, stel limieten
confirmDuplicatesInfo: `De duplicaten die je niet behoudt, worden bewaard zodat de indiener ze kan verwijderen.`,
hold: 'Deze uitgave is in de wacht gezet',
resolvedDuplicates: 'het duplicaat opgelost',
companyCardRequired: 'Aankopen met bedrijfskaart verplicht',
},
reportViolations: {
[CONST.REPORT_VIOLATIONS.FIELD_REQUIRED]: ({fieldName}: RequiredFieldParams) => `${fieldName} is verplicht`,
Expand Down
5 changes: 4 additions & 1 deletion src/languages/pl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2707,7 +2707,7 @@ ${amount} dla ${merchant} - ${date}`,
`Połącz${integrationName === CONST.ONBOARDING_ACCOUNTING_MAPPING.other ? '' : 'do'} [${integrationName === CONST.ONBOARDING_ACCOUNTING_MAPPING.other ? 'twój' : ''} ${integrationName}](${workspaceAccountingLink})`,
description: ({integrationName, workspaceAccountingLink}) =>
dedent(`
Połącz ${integrationName === CONST.ONBOARDING_ACCOUNTING_MAPPING.other ? 'twój' : 'do'} ${integrationName}, aby automatycznie kategoryzować i synchronizować wydatki, co znacznie ułatwia zamknięcie miesiąca.
Połącz ${integrationName === CONST.ONBOARDING_ACCOUNTING_MAPPING.other ? 'twój' : 'do'} ${integrationName}, aby włączyć automatyczne kodowanie wydatków i synchronizację, co znacznie ułatwia zamknięcie miesiąca.

1. Kliknij *Workspaces*.
2. Wybierz swój workspace.
Expand Down Expand Up @@ -6172,6 +6172,8 @@ Wymagaj szczegółów wydatków, takich jak paragony i opisy, ustawiaj limity i
gambling: 'Hazard',
tobacco: 'Tytoń',
adultEntertainment: 'Rozrywka dla dorosłych',
requireCompanyCard: 'Wymagaj kart firmowych dla wszystkich zakupów',
requireCompanyCardDescription: 'Oznacz wszystkie wydatki gotówkowe, w tym koszty za przejechane kilometry i diety.',
},
expenseReportRules: {
title: 'Zaawansowany',
Expand Down Expand Up @@ -7341,6 +7343,7 @@ Wymagaj szczegółów wydatków, takich jak paragony i opisy, ustawiaj limity i
confirmDuplicatesInfo: `Duplikaty, których nie zachowasz, zostaną pozostawione do usunięcia przez osobę przesyłającą.`,
hold: 'Ten wydatek został wstrzymany',
resolvedDuplicates: 'rozwiązano duplikat',
companyCardRequired: 'Wymagane zakupy kartą firmową',
},
reportViolations: {
[CONST.REPORT_VIOLATIONS.FIELD_REQUIRED]: ({fieldName}: RequiredFieldParams) => `Pole ${fieldName} jest wymagane`,
Expand Down
3 changes: 3 additions & 0 deletions src/languages/pt-BR.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6173,6 +6173,8 @@ Exija detalhes de despesas como recibos e descrições, defina limites e padrõe
gambling: 'Jogos de azar',
tobacco: 'Tabaco',
adultEntertainment: 'Entretenimento adulto',
requireCompanyCard: 'Exigir cartões corporativos para todas as compras',
requireCompanyCardDescription: 'Sinalize todas as despesas em dinheiro, incluindo quilometragem e diárias.',
},
expenseReportRules: {
title: 'Avançado',
Expand Down Expand Up @@ -7345,6 +7347,7 @@ Exija detalhes de despesas como recibos e descrições, defina limites e padrõe
confirmDuplicatesInfo: `Os duplicados que você não mantiver serão mantidos para que o remetente os exclua.`,
hold: 'Esta despesa foi colocada em espera',
resolvedDuplicates: 'duplicata resolvida',
companyCardRequired: 'Compras com cartão da empresa obrigatórias',
},
reportViolations: {
[CONST.REPORT_VIOLATIONS.FIELD_REQUIRED]: ({fieldName}: RequiredFieldParams) => `${fieldName} é obrigatório`,
Expand Down
5 changes: 4 additions & 1 deletion src/languages/zh-hans.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2692,7 +2692,7 @@ ${
}`),
},
connectCorporateCardTask: {
title: ({corporateCardLink}) => `连接[您的公司卡](${corporateCardLink})`,
title: ({corporateCardLink}) => `连接[您的公司信用卡](${corporateCardLink})`,
description: ({corporateCardLink}) =>
dedent(`
连接您已有的卡片,以自动导入交易、匹配收据和进行对账。
Expand Down Expand Up @@ -6063,6 +6063,8 @@ ${reportName}
gambling: '赌博',
tobacco: '烟草',
adultEntertainment: '成人娱乐',
requireCompanyCard: '所有购买均需使用公司卡',
requireCompanyCardDescription: '标记所有现金支出,包括里程和日津贴费用。',
},
expenseReportRules: {
title: '高级',
Expand Down Expand Up @@ -7203,6 +7205,7 @@ ${reportName}
confirmDuplicatesInfo: `您不保留的重复项将由提交者自行删除。`,
hold: '此报销已被搁置',
resolvedDuplicates: '已解决重复项',
companyCardRequired: '需要公司卡消费',
},
reportViolations: {
[CONST.REPORT_VIOLATIONS.FIELD_REQUIRED]: ({fieldName}: RequiredFieldParams) => `${fieldName}为必填项`,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
type SetPolicyRequireCompanyCardsEnabled = {
policyID: string;
enabled: boolean;
};

export default SetPolicyRequireCompanyCardsEnabled;
1 change: 1 addition & 0 deletions src/libs/API/parameters/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -448,3 +448,4 @@ export type {default as SetSamlIdentityParams} from './SetSamlIdentityParams';
export type {default as UpdateSamlEnabledParams} from './UpdateSamlEnabledParams';
export type {default as UpdateSamlRequiredParams} from './UpdateSamlRequiredParams';
export type {default as OpenSearchPageParams} from './OpenSearchPageParams';
export type {default as SetPolicyRequireCompanyCardsEnabledParams} from './SetPolicyRequireCompanyCardsEnabled';
2 changes: 2 additions & 0 deletions src/libs/API/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,7 @@ const WRITE_COMMANDS = {
DISABLE_POLICY_BILLABLE_MODE: 'DisablePolicyBillableExpenses',
SET_WORKSPACE_ERECEIPTS_ENABLED: 'SetWorkspaceEReceiptsEnabled',
SET_POLICY_ATTENDEE_TRACKING_ENABLED: 'SetPolicyAttendeeTrackingEnabled',
SET_POLICY_REQUIRE_COMPANY_CARDS_ENABLED: 'SetPolicyRequireCompanyCardsEnabled',
SET_POLICY_CATEGORY_DESCRIPTION_REQUIRED: 'SetPolicyCategoryDescriptionRequired',
SET_WORKSPACE_CATEGORY_DESCRIPTION_HINT: 'SetWorkspaceCategoryDescriptionHint',
SET_POLICY_CATEGORY_RECEIPTS_REQUIRED: 'SetPolicyCategoryReceiptsRequired',
Expand Down Expand Up @@ -779,6 +780,7 @@ type WriteCommandParameters = {
[WRITE_COMMANDS.ENABLE_POLICY_COMPANY_CARDS]: Parameters.EnablePolicyCompanyCardsParams;
[WRITE_COMMANDS.ENABLE_POLICY_INVOICING]: Parameters.EnablePolicyInvoicingParams;
[WRITE_COMMANDS.SET_POLICY_RULES_ENABLED]: Parameters.SetPolicyRulesEnabledParams;
[WRITE_COMMANDS.SET_POLICY_REQUIRE_COMPANY_CARDS_ENABLED]: Parameters.SetPolicyRequireCompanyCardsEnabledParams;
[WRITE_COMMANDS.SET_POLICY_CATEGORY_DESCRIPTION_REQUIRED]: Parameters.SetPolicyCategoryDescriptionRequiredParams;
[WRITE_COMMANDS.SET_WORKSPACE_CATEGORY_DESCRIPTION_HINT]: Parameters.SetWorkspaceCategoryDescriptionHintParams;
[WRITE_COMMANDS.SET_POLICY_CATEGORY_RECEIPTS_REQUIRED]: Parameters.SetPolicyCategoryReceiptsRequiredParams;
Expand Down
2 changes: 2 additions & 0 deletions src/libs/Violations/ViolationsUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -582,6 +582,8 @@ const ViolationsUtils = {
return translate('violations.taxRequired');
case 'hold':
return translate('violations.hold');
case 'companyCardRequired':
return translate('violations.companyCardRequired');
case CONST.VIOLATIONS.PROHIBITED_EXPENSE:
return translate('violations.prohibitedExpense', {
prohibitedExpenseTypes: violation.data?.prohibitedExpenseRule ?? [],
Expand Down
Loading
Loading