Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
0e8a196
Revert "[CP Staging] Revert "Merge pull request #74967 from FitseTLT/…
FitseTLT Mar 4, 2026
605d51e
fix rate selection bug when policyForMovingExpenses submission is off
FitseTLT Mar 4, 2026
2cfdaaf
fix participant resetting bug when BE response on rate update arrive
FitseTLT Mar 4, 2026
ca2507a
fix tax updating bug on rate change
FitseTLT Mar 4, 2026
271ce41
fix distance manual page distance unit bug
FitseTLT Mar 4, 2026
05796b0
fix unit bug for p2p custom unit rate
FitseTLT Mar 5, 2026
ec9486c
Merge branch 'main' into pr/FitseTLT/84136
FitseTLT Mar 5, 2026
ad2443e
set taxValue of transaction on rate change
FitseTLT Mar 5, 2026
f15021e
Merge branch 'main' into pr/FitseTLT/84136
FitseTLT Mar 5, 2026
42092f6
Merge branch 'main' into pr/FitseTLT/84136
FitseTLT Mar 6, 2026
86a3f86
Merge branch 'main' into pr/FitseTLT/84136
FitseTLT Mar 10, 2026
79092f6
Merge branch 'main' into pr/FitseTLT/84136
FitseTLT Mar 11, 2026
122a9cf
Merge branch 'main' into pr/FitseTLT/84136
FitseTLT Mar 25, 2026
92783bf
Merge branch 'main' into pr/FitseTLT/84136
FitseTLT Mar 26, 2026
044b449
handle unit change for moving track expense
FitseTLT Mar 26, 2026
f006b69
Merge branch 'main' into pr/FitseTLT/84136
FitseTLT Mar 27, 2026
682a9e2
Merge branch 'main' into pr/FitseTLT/84136
FitseTLT Mar 27, 2026
78f1631
update policy argument for setCustomUnitRateID
FitseTLT Mar 27, 2026
b338612
revert back policy prop for transaction item
FitseTLT Mar 27, 2026
99b8270
Merge main
FitseTLT Apr 1, 2026
f1a1d75
Merge branch 'main' into pr/FitseTLT/84136
FitseTLT Apr 2, 2026
129aea4
Merge branch 'main' into pr/FitseTLT/84136
FitseTLT Apr 6, 2026
ab5fe0b
conflict resolution
FitseTLT Apr 6, 2026
e54550a
Merge branch 'main' into pr/FitseTLT/84136
FitseTLT Apr 6, 2026
0619242
resolve conflict
FitseTLT Apr 6, 2026
5a7b9c1
minor fix
FitseTLT Apr 6, 2026
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
4 changes: 2 additions & 2 deletions src/ROUTES.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2782,8 +2782,8 @@ const ROUTES = {
},
WORKSPACE_CREATE_DISTANCE_RATE_UPGRADE: {
route: 'workspaces/:policyID/distance-rates/new/upgrade',
getRoute: (policyID: string, transactionID?: string, reportID?: string) =>
`workspaces/${policyID}/distance-rates/new/upgrade${transactionID ? `?transactionID=${transactionID}` : ''}${reportID ? `&reportID=${reportID}` : ''}` as const,
getRoute: (policyID: string, transactionID?: string, reportID?: string, iouType?: string, action?: string) =>
`workspaces/${policyID}/distance-rates/new/upgrade${transactionID ? `?transactionID=${transactionID}` : ''}${reportID ? `&reportID=${reportID}` : ''}${iouType ? `&iouType=${iouType}` : ''}${action ? `&action=${action}` : ''}` as const,
},
WORKSPACE_DISTANCE_RATES_SETTINGS: {
route: 'workspaces/:policyID/distance-rates/settings',
Expand Down
15 changes: 9 additions & 6 deletions src/components/MoneyRequestConfirmationList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@
const [defaultMileageRateDraft] = useOnyx(`${ONYXKEYS.COLLECTION.POLICY_DRAFTS}${policyID}`, {
selector: mileageRateSelector,
});
const {policyForMovingExpenses} = usePolicyForMovingExpenses();
const {policyForMovingExpenses, shouldSelectPolicy} = usePolicyForMovingExpenses();
const isMovingTransactionFromTrackExpense = isMovingTransactionFromTrackExpenseUtil(action);
const [defaultMileageRateReal] = useOnyx(`${ONYXKEYS.COLLECTION.POLICY}${policyID}`, {
selector: mileageRateSelector,
Expand Down Expand Up @@ -363,7 +363,12 @@
const defaultRate = defaultMileageRate?.customUnitRateID;
const lastSelectedRate = policy?.id ? (lastSelectedDistanceRates?.[policy.id] ?? defaultRate) : defaultRate;

const mileageRate = DistanceRequestUtils.getRate({transaction, policy, policyDraft});
const mileageRate = DistanceRequestUtils.getRate({
transaction,
policy,
...(isMovingTransactionFromTrackExpense && {policyForMovingExpenses}),
policyDraft,
});
const rate = mileageRate.rate;
const prevRate = usePrevious(rate);
const unit = mileageRate.unit;
Expand All @@ -372,8 +377,6 @@
const prevCurrency = usePrevious(currency);
const prevSubRates = usePrevious(subRates);

const {shouldSelectPolicy} = usePolicyForMovingExpenses();

// A flag for showing the categories field
const shouldShowCategories = isTrackExpense
? !policy || shouldSelectPolicy || hasEnabledOptions(Object.values(policyCategories ?? {}))
Expand Down Expand Up @@ -531,8 +534,8 @@
const errorKey = 'iou.error.invalidRate';
const policyRates = DistanceRequestUtils.getMileageRates(policy);

// If the selected rate belongs to the policy, clear the error
if (customUnitRateID && customUnitRateID in policyRates) {
// If the selected rate belongs to the policy, and for moving track expense if the units also matches, clear the error
if (customUnitRateID && customUnitRateID in policyRates && (!isMovingTransactionFromTrackExpense || policyRates[customUnitRateID].unit === mileageRate.unit)) {
clearFormErrors([errorKey]);
return;
}
Expand Down Expand Up @@ -1138,7 +1141,7 @@
onSendMoney?.(paymentMethod);
}
},
[

Check warning on line 1144 in src/components/MoneyRequestConfirmationList.tsx

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

React Hook useCallback has a missing dependency: 'isNewManualExpenseFlowEnabled'. Either include it or remove the dependency array

Check warning on line 1144 in src/components/MoneyRequestConfirmationList.tsx

View workflow job for this annotation

GitHub Actions / ESLint check

React Hook useCallback has a missing dependency: 'isNewManualExpenseFlowEnabled'. Either include it or remove the dependency array
routeError,
transactionID,
iouType,
Expand Down
16 changes: 11 additions & 5 deletions src/components/MoneyRequestConfirmationListFooter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -508,7 +508,7 @@ function MoneyRequestConfirmationListFooter({

const mentionReportContextValue = useMemo(() => ({currentReportID: reportID, exactlyMatch: true}), [reportID]);

const isRateInteractive = !!rate && !isReadOnly && (!isUnreported || isTrackExpense) && iouType !== CONST.IOU.TYPE.SPLIT;
const isRateInteractive = !!rate && !isReadOnly && iouType !== CONST.IOU.TYPE.SPLIT;

const getCategoryRightLabelIcon = useCallback(() => (willFieldBeAutomaticallyFilled(transaction, 'category') ? icons.Sparkles : undefined), [transaction, icons.Sparkles]);
const getCategoryRightLabel = useCallback(() => {
Expand Down Expand Up @@ -738,7 +738,7 @@ function MoneyRequestConfirmationListFooter({
return;
}

if (!isPolicyExpenseChat) {
if ((!isPolicyExpenseChat && !isTrackExpense) || (shouldNavigateToUpgradePath && isTrackExpense)) {
Navigation.navigate(
ROUTES.MONEY_REQUEST_UPGRADE.getRoute({
action,
Expand All @@ -747,12 +747,18 @@ function MoneyRequestConfirmationListFooter({
reportID,
upgradePath: CONST.UPGRADE_PATHS.DISTANCE_RATES,
backTo: Navigation.getActiveRoute(),
shouldSubmitExpense: true,
shouldSubmitExpense: !isTrackExpense,
}),
);
return;
} else if (!policy && shouldSelectPolicy && isTrackExpense) {
Navigation.navigate(
ROUTES.SET_DEFAULT_WORKSPACE.getRoute(
ROUTES.MONEY_REQUEST_STEP_DISTANCE_RATE.getRoute(action, iouType, transactionID, reportID, Navigation.getActiveRoute(), reportActionID),
),
);
} else {
Navigation.navigate(ROUTES.MONEY_REQUEST_STEP_DISTANCE_RATE.getRoute(action, iouType, transactionID, reportID, Navigation.getActiveRoute(), reportActionID));
}
Navigation.navigate(ROUTES.MONEY_REQUEST_STEP_DISTANCE_RATE.getRoute(action, iouType, transactionID, reportID, Navigation.getActiveRoute(), reportActionID));
}}
brickRoadIndicator={shouldDisplayDistanceRateError ? CONST.BRICK_ROAD_INDICATOR_STATUS.ERROR : undefined}
disabled={didConfirm}
Expand Down
49 changes: 46 additions & 3 deletions src/components/ReportActionItem/MoneyRequestView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,7 @@ function MoneyRequestView({
isEditable &&
canEditFieldOfMoneyRequest({reportAction: parentReportAction, fieldToEdit: CONST.EDIT_REQUEST_FIELD.DATE, isChatReportArchived, transaction, report: moneyRequestReport, policy});

const canEditDistanceOrRate = isPolicyAccessible(policy, currentUserEmailParam) || isP2PDistanceRequest;
const canEditDistanceOrRate = isPolicyAccessible(policy, currentUserEmailParam) || isTrackExpense || isP2PDistanceRequest;

const canEditDistance =
!isGPSDistanceRequest &&
Expand Down Expand Up @@ -455,8 +455,22 @@ function MoneyRequestView({
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 = DistanceRequestUtils.getRateForExpenseDisplay(rateName, isCustomUnitOutOfPolicy, unit, rate, currency, translate, toLocaleDigit, getCurrencySymbol, isOffline);
const isCustomUnitOutOfPolicy =
(transactionViolations.some((violation) => violation.name === CONST.VIOLATIONS.CUSTOM_UNIT_OUT_OF_POLICY) || (isDistanceRequest && !rate)) && !isTrackExpense;
const calculateFromTransactionData = isTrackExpense && !rate;
const distanceUnit = calculateFromTransactionData ? transaction?.comment?.customUnit?.distanceUnit : unit;
const distanceRate = calculateFromTransactionData ? (transactionAmount ?? 0) / (transaction?.comment?.customUnit?.quantity ?? 1) : rate;
let rateToDisplay = DistanceRequestUtils.getRateForExpenseDisplay(
rateName,
isCustomUnitOutOfPolicy,
distanceUnit,
distanceRate,
currency,
translate,
toLocaleDigit,
getCurrencySymbol,
isOffline,
);
const distanceToDisplay = DistanceRequestUtils.getDistanceForDisplay(hasRoute, distance, unit, rate, translate, undefined, isManualDistanceRequest);
let merchantTitle = isEmptyMerchant ? '' : transactionMerchant;
let amountTitle = formattedTransactionAmount?.toString() || '';
Expand Down Expand Up @@ -699,6 +713,35 @@ function MoneyRequestView({
return;
}

if (isTrackExpense) {
if (shouldNavigateToUpgradePath && transactionThreadReport) {
Navigation.navigate(
ROUTES.MONEY_REQUEST_UPGRADE.getRoute({
action: CONST.IOU.ACTION.EDIT,
iouType,
transactionID: transaction.transactionID,
reportID: transactionThreadReport?.reportID,
upgradePath: CONST.UPGRADE_PATHS.DISTANCE_RATES,
}),
);
return;
}
if (!policy && shouldSelectPolicy) {
Navigation.navigate(
ROUTES.SET_DEFAULT_WORKSPACE.getRoute(
ROUTES.MONEY_REQUEST_STEP_DISTANCE_RATE.getRoute(
CONST.IOU.ACTION.EDIT,
iouType,
transaction.transactionID,
transactionThreadReport?.reportID,
Navigation.getActiveRoute(),
),
),
);
return;
}
}

Navigation.navigate(
ROUTES.MONEY_REQUEST_STEP_DISTANCE_RATE.getRoute(
CONST.IOU.ACTION.EDIT,
Expand Down
10 changes: 3 additions & 7 deletions src/components/TransactionItemRow/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ import {
isMerchantMissing,
isScanning,
isTimeRequest,
isUnreportedAndHasInvalidDistanceRateTransaction,
shouldShowAttendees as shouldShowAttendeesUtils,
} from '@libs/TransactionUtils';
import variables from '@styles/variables';
Expand Down Expand Up @@ -237,9 +236,7 @@ function TransactionItemRow({
return '';
}

const policyParam = policy ?? transactionItem.policy;
const isCustomUnitOutOfPolicy = isUnreportedAndHasInvalidDistanceRateTransaction(transactionItem, policyParam);
const hasFieldErrors = hasMissingSmartscanFields(transactionItem, report) || isCustomUnitOutOfPolicy;
const hasFieldErrors = hasMissingSmartscanFields(transactionItem, report);
if (hasFieldErrors) {
const amountMissing = isAmountMissing(transactionItem);
const merchantMissing = isMerchantMissing(transactionItem);
Expand All @@ -251,12 +248,11 @@ function TransactionItemRow({
error = translate('iou.missingAmount');
} else if (merchantMissing && !isSettled(report)) {
error = translate('iou.missingMerchant');
} else if (isCustomUnitOutOfPolicy) {
error = translate('violations.customUnitOutOfPolicy');
}

return error;
}
}, [transactionItem, translate, report, policy]);
}, [transactionItem, translate, report]);

const exchangeRateMessage = getExchangeRate(transactionItem, report?.currency);

Expand Down
7 changes: 5 additions & 2 deletions src/hooks/usePolicyForTransaction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ type UsePolicyForTransactionParams = {
/** The type of IOU (split, track, submit, etc.) */
iouType: string;

/** The draft policy linked to the report */
policyDraft?: OnyxEntry<Policy>;

/** Indicates if the request is a per diem request */
isPerDiemRequest?: boolean;
};
Expand All @@ -30,7 +33,7 @@ type UsePolicyForTransactionResult = {
policy: OnyxEntry<Policy>;
};

function usePolicyForTransaction({transaction, reportPolicyID, action, iouType, isPerDiemRequest}: UsePolicyForTransactionParams): UsePolicyForTransactionResult {
function usePolicyForTransaction({transaction, reportPolicyID, action, iouType, policyDraft, isPerDiemRequest}: UsePolicyForTransactionParams): UsePolicyForTransactionResult {
const {policyForMovingExpenses} = usePolicyForMovingExpenses();

const [allPolicies] = useOnyx(ONYXKEYS.COLLECTION.POLICY);
Expand All @@ -45,7 +48,7 @@ function usePolicyForTransaction({transaction, reportPolicyID, action, iouType,
const isCreatingTrackExpense = action === CONST.IOU.ACTION.CREATE && iouType === CONST.IOU.TYPE.TRACK;

const policyForSelfDMExpense = isPerDiemRequest ? customUnitPolicy : policyForMovingExpenses;
const policy = isUnreportedExpense || isCreatingTrackExpense ? policyForSelfDMExpense : reportPolicy;
const policy = isUnreportedExpense || isCreatingTrackExpense ? policyForSelfDMExpense : (reportPolicy ?? policyDraft);

return {policy};
}
Expand Down
25 changes: 15 additions & 10 deletions src/libs/DistanceRequestUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {replaceAllDigits} from './MoneyRequestUtils';
// This will be fixed as part of https://github.com/Expensify/App/issues/66397
// eslint-disable-next-line @typescript-eslint/no-deprecated
import {getDistanceRateCustomUnit, getDistanceRateCustomUnitRate, getPersonalPolicy, getUnitRateValue} from './PolicyUtils';
import {getCurrency, getRateID, isCustomUnitRateIDForP2P} from './TransactionUtils';
import {getCurrency, getRateID, isCustomUnitRateIDForP2P, isExpenseUnreported} from './TransactionUtils';

type MileageRate = {
customUnitRateID?: string;
Expand Down Expand Up @@ -338,32 +338,31 @@ function getCustomUnitRateID({
reportID,
isPolicyExpenseChat,
policy,
isTrackDistanceExpense = false,
lastSelectedDistanceRates,
}: {
reportID: string | undefined;
isPolicyExpenseChat: boolean;
policy: OnyxEntry<Policy> | undefined;
lastSelectedDistanceRates?: OnyxEntry<LastSelectedDistanceRates>;
isTrackDistanceExpense?: boolean;
}): string {
let customUnitRateID: string = CONST.CUSTOM_UNITS.FAKE_P2P_ID;

if (!reportID) {
return customUnitRateID;
}

if (reportID === CONST.REPORT.UNREPORTED_REPORT_ID) {
return customUnitRateID;
}

if (isEmptyObject(policy)) {
return customUnitRateID;
}

if (isPolicyExpenseChat) {
// For TrackDistanceExpense we will return the default rate of the policyForMovingExpenses.
if (isPolicyExpenseChat || isTrackDistanceExpense) {
const distanceUnit = Object.values(policy.customUnits ?? {}).find((unit) => unit.name === CONST.CUSTOM_UNITS.NAME_DISTANCE);
const lastSelectedDistanceRateID = lastSelectedDistanceRates?.[policy.id];
const lastSelectedDistanceRate = lastSelectedDistanceRateID ? distanceUnit?.rates[lastSelectedDistanceRateID] : undefined;
if (lastSelectedDistanceRate?.enabled && lastSelectedDistanceRateID) {
if (!isTrackDistanceExpense && lastSelectedDistanceRate?.enabled && lastSelectedDistanceRateID) {
customUnitRateID = lastSelectedDistanceRateID;
} else {
const defaultMileageRate = getDefaultMileageRate(policy);
Expand Down Expand Up @@ -408,24 +407,30 @@ function getRate({
policy,
policyDraft,
useTransactionDistanceUnit = true,
policyForMovingExpenses,
isFakeP2PRate,
}: {
transaction: OnyxEntry<Transaction>;
policy: OnyxEntry<Policy>;
policyDraft?: OnyxEntry<Policy>;
policyForMovingExpenses?: OnyxEntry<Policy>;
useTransactionDistanceUnit?: boolean;
isFakeP2PRate?: boolean;
}): MileageRate {
let mileageRates = getMileageRates(policy, true, transaction?.comment?.customUnit?.customUnitRateID);
if (isEmptyObject(mileageRates) && policyDraft) {
mileageRates = getMileageRates(policyDraft, true, transaction?.comment?.customUnit?.customUnitRateID);
}
const mileageRatesForMovingExpenses = getMileageRates(policyForMovingExpenses, true, transaction?.comment?.customUnit?.customUnitRateID);
// This will be fixed as part of https://github.com/Expensify/App/issues/66397
// eslint-disable-next-line @typescript-eslint/no-deprecated
const policyCurrency = policy?.outputCurrency ?? getPersonalPolicy()?.outputCurrency ?? CONST.CURRENCY.USD;
const isUnreportedExpense = isExpenseUnreported(transaction);
const defaultMileageRate = getDefaultMileageRate(policy);
const customUnitRateID = getRateID(transaction);
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
const customMileageRate = (customUnitRateID && mileageRates?.[customUnitRateID]) || defaultMileageRate;
const mileageRate = isCustomUnitRateIDForP2P(transaction) ? getRateForP2P(policyCurrency, transaction) : customMileageRate;
const customMileageRate =
(customUnitRateID && (mileageRates?.[customUnitRateID] ?? mileageRatesForMovingExpenses?.[customUnitRateID])) || (isUnreportedExpense ? undefined : defaultMileageRate);
const mileageRate = isCustomUnitRateIDForP2P(transaction) || isFakeP2PRate ? getRateForP2P(policyCurrency, transaction) : customMileageRate;
const unit = getDistanceUnit(useTransactionDistanceUnit ? transaction : undefined, mileageRate);
return {
...mileageRate,
Expand Down
2 changes: 2 additions & 0 deletions src/libs/Navigation/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -698,6 +698,8 @@ type SettingsNavigatorParamList = {
policyID: string;
transactionID?: string;
reportID?: string;
action?: IOUAction;
iouType?: IOUType;
};
[SCREENS.WORKSPACE.DISTANCE_RATES_SETTINGS]: {
policyID: string;
Expand Down
9 changes: 4 additions & 5 deletions src/libs/ReportUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1055,7 +1055,7 @@
};

let conciergeReportIDOnyxConnect: OnyxEntry<string>;
Onyx.connect({

Check warning on line 1058 in src/libs/ReportUtils.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
key: ONYXKEYS.CONCIERGE_REPORT_ID,
callback: (value) => {
conciergeReportIDOnyxConnect = value;
Expand All @@ -1063,7 +1063,7 @@
});

const defaultAvatarBuildingIconTestID = 'SvgDefaultAvatarBuilding Icon';
Onyx.connect({

Check warning on line 1066 in src/libs/ReportUtils.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
key: ONYXKEYS.SESSION,
callback: (value) => {
// When signed out, val is undefined
Expand All @@ -1081,7 +1081,7 @@
let allPersonalDetails: OnyxEntry<PersonalDetailsList>;
let allPersonalDetailLogins: string[];
let currentUserPersonalDetails: OnyxEntry<PersonalDetails>;
Onyx.connect({

Check warning on line 1084 in src/libs/ReportUtils.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
key: ONYXKEYS.PERSONAL_DETAILS_LIST,
callback: (value) => {
if (deprecatedCurrentUserAccountID) {
Expand All @@ -1093,7 +1093,7 @@
});

let allReportsDraft: OnyxCollection<Report>;
Onyx.connect({

Check warning on line 1096 in src/libs/ReportUtils.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
key: ONYXKEYS.COLLECTION.REPORT_DRAFT,
waitForCollectionCallback: true,
callback: (value) => (allReportsDraft = value),
Expand All @@ -1101,7 +1101,7 @@

let allPolicies: OnyxCollection<Policy>;
let policiesArray: Policy[] = [];
Onyx.connect({

Check warning on line 1104 in src/libs/ReportUtils.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
key: ONYXKEYS.COLLECTION.POLICY,
waitForCollectionCallback: true,
callback: (value) => {
Expand All @@ -1111,7 +1111,7 @@
});

let allPolicyDrafts: OnyxCollection<Policy>;
Onyx.connect({

Check warning on line 1114 in src/libs/ReportUtils.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
key: ONYXKEYS.COLLECTION.POLICY_DRAFTS,
waitForCollectionCallback: true,
callback: (value) => (allPolicyDrafts = value),
Expand All @@ -1119,7 +1119,7 @@

let allReports: OnyxCollection<Report>;
let reportsByPolicyID: ReportByPolicyMap;
Onyx.connect({

Check warning on line 1122 in src/libs/ReportUtils.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
key: ONYXKEYS.COLLECTION.REPORT,
waitForCollectionCallback: true,
callback: (value) => {
Expand Down Expand Up @@ -1155,14 +1155,14 @@
});

let betaConfiguration: OnyxEntry<BetaConfiguration> = {};
Onyx.connect({

Check warning on line 1158 in src/libs/ReportUtils.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
key: ONYXKEYS.BETA_CONFIGURATION,
callback: (value) => (betaConfiguration = value ?? {}),
});

let deprecatedAllTransactions: OnyxCollection<Transaction> = {};
let deprecatedReportsTransactions: Record<string, Transaction[]> = {};
Onyx.connect({

Check warning on line 1165 in src/libs/ReportUtils.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
key: ONYXKEYS.COLLECTION.TRANSACTION,
waitForCollectionCallback: true,
callback: (value) => {
Expand Down Expand Up @@ -5008,15 +5008,15 @@
);
}

// Unreported transaction from OldDot can have the reportID as an empty string
const isUnreportedExpense = !transaction?.reportID || transaction?.reportID === CONST.REPORT.UNREPORTED_REPORT_ID;

if (fieldToEdit === CONST.EDIT_REQUEST_FIELD.DISTANCE_RATE) {
// The distance rate can be modified only on the distance expense reports
return isExpenseReport(moneyRequestReport) && isDistanceRequest(transaction);
return (isExpenseReport(moneyRequestReport) || isUnreportedExpense) && isDistanceRequest(transaction);
}

if (fieldToEdit === CONST.EDIT_REQUEST_FIELD.REPORT) {
// Unreported transaction from OldDot can have the reportID as an empty string
const isUnreportedExpense = !transaction?.reportID || transaction?.reportID === CONST.REPORT.UNREPORTED_REPORT_ID;

if (isUnreportedExpense) {
if (isPerDiemRequest(transaction)) {
// For unreported per diem expenses, check if there's a valid policy with rates.
Expand Down Expand Up @@ -5076,7 +5076,6 @@
return false;
}

const isUnreportedExpense = !transaction?.reportID || transaction?.reportID === CONST.REPORT.UNREPORTED_REPORT_ID;
if (isUnreportedExpense && !isRequestor) {
return false;
}
Expand Down
Loading
Loading