Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
3 changes: 2 additions & 1 deletion src/components/AddExistingExpenseFooter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ function AddExistingExpenseFooter({selectedIds, report, reportToConfirm, policy,
const styles = useThemeStyles();
const {isBetaEnabled} = usePermissions();
const isASAPSubmitBetaEnabled = isBetaEnabled(CONST.BETAS.ASAP_SUBMIT);
const {getCurrencyDecimals} = useCurrencyListActions();
const {getCurrencyDecimals, getCurrencySymbol} = useCurrencyListActions();
const session = useSession();
const personalDetails = usePersonalDetails();
const delegateAccountID = useDelegateAccountID();
Expand Down Expand Up @@ -116,6 +116,7 @@ function AddExistingExpenseFooter({selectedIds, report, reportToConfirm, policy,
selfDMReportActions,
delegateAccountID,
getCurrencyDecimals,
getCurrencySymbol,
});
}
},
Expand Down
3 changes: 2 additions & 1 deletion src/hooks/useUndeleteTransactions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import usePermissions from './usePermissions';
function useUndeleteTransactions() {
const currentUserPersonalDetails = useCurrentUserPersonalDetails();
const delegateAccountID = useDelegateAccountID();
const {getCurrencyDecimals} = useCurrencyListActions();
const {getCurrencyDecimals, getCurrencySymbol} = useCurrencyListActions();
const {isBetaEnabled} = usePermissions();
const isASAPSubmitBetaEnabled = isBetaEnabled(CONST.BETAS.ASAP_SUBMIT);
const [personalPolicyID] = useOnyx(ONYXKEYS.PERSONAL_POLICY_ID);
Expand Down Expand Up @@ -46,6 +46,7 @@ function useUndeleteTransactions() {
personalPolicyOutputCurrency: policy?.outputCurrency,
delegateAccountID,
getCurrencyDecimals,
getCurrencySymbol,
});
};
}
Expand Down
1 change: 0 additions & 1 deletion src/libs/CurrencyUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,6 @@ export {
resetInvalidCurrencyWarningsForTesting,
getCurrencyDecimals,
getLocalizedCurrencySymbol,
getCurrencySymbol,
convertToBackendAmount,
convertToFrontendAmountAsInteger,
convertToFrontendAmountAsString,
Expand Down
3 changes: 3 additions & 0 deletions src/libs/actions/Report/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -472,6 +472,7 @@ type MergeReportsProps = {
selfDMReportActions: OnyxEntry<ReportActions>;
delegateAccountID: number | undefined;
getCurrencyDecimals: CurrencyListActionsContextType['getCurrencyDecimals'];
getCurrencySymbol: CurrencyListActionsContextType['getCurrencySymbol'];
};

const addNewMessageWithText = new Set<string>([WRITE_COMMANDS.ADD_COMMENT, WRITE_COMMANDS.ADD_TEXT_AND_ATTACHMENT]);
Expand Down Expand Up @@ -8451,6 +8452,7 @@ function mergeReports({
selfDMReportActions,
delegateAccountID,
getCurrencyDecimals,
getCurrencySymbol,
}: MergeReportsProps) {
const reports = allReportsParam ?? allReports;
const destinationReport = reports?.[`${ONYXKEYS.COLLECTION.REPORT}${destinationReportID}`];
Expand Down Expand Up @@ -8481,6 +8483,7 @@ function mergeReports({
selfDMReportActions,
delegateAccountID,
getCurrencyDecimals,
getCurrencySymbol,
});

const {
Expand Down
3 changes: 2 additions & 1 deletion src/libs/actions/Transaction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import type {
TransactionThreadInfo,
} from '@libs/API/parameters';
import {READ_COMMANDS, WRITE_COMMANDS} from '@libs/API/types';
import {getCurrencySymbol} from '@libs/CurrencyUtils';
import DateUtils from '@libs/DateUtils';
import DistanceRequestUtils from '@libs/DistanceRequestUtils';
import {toLocaleDigit} from '@libs/LocaleDigitUtils';
Expand Down Expand Up @@ -860,6 +859,7 @@ type ChangeTransactionsReportProps = {
selfDMReportActions: OnyxEntry<ReportActions>;
delegateAccountID: number | undefined;
getCurrencyDecimals: CurrencyListActionsContextType['getCurrencyDecimals'];
getCurrencySymbol: CurrencyListActionsContextType['getCurrencySymbol'];
};

function getChangeTransactionsReportOnyxData({
Expand All @@ -880,6 +880,7 @@ function getChangeTransactionsReportOnyxData({
selfDMReportActions,
delegateAccountID,
getCurrencyDecimals,
getCurrencySymbol,
}: ChangeTransactionsReportProps) {
const reportID = newReport?.reportID ?? CONST.REPORT.UNREPORTED_REPORT_ID;

Expand Down
3 changes: 2 additions & 1 deletion src/pages/DynamicNewReportWorkspaceSelectionPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ function DynamicNewReportWorkspaceSelectionPage({route}: NewReportWorkspaceSelec
const currentUserPersonalDetails = useCurrentUserPersonalDetails();
const delegateAccountID = useDelegateAccountID();
const personalPolicy = usePersonalPolicy();
const {getCurrencyDecimals} = useCurrencyListActions();
const {getCurrencyDecimals, getCurrencySymbol} = useCurrencyListActions();

const selectedTransactionsKeys = Object.keys(selectedTransactions);
const transactionIDs = selectedTransactionsKeys.length ? selectedTransactionsKeys : selectedTransactionIDs;
Expand Down Expand Up @@ -151,6 +151,7 @@ function DynamicNewReportWorkspaceSelectionPage({route}: NewReportWorkspaceSelec
selfDMReportActions,
delegateAccountID,
getCurrencyDecimals,
getCurrencySymbol,
});

// eslint-disable-next-line rulesdir/no-default-id-values
Expand Down
5 changes: 4 additions & 1 deletion src/pages/Search/SearchTransactionsChangeReport.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ function SearchTransactionsChangeReport() {
const isASAPSubmitBetaEnabled = isBetaEnabled(CONST.BETAS.ASAP_SUBMIT);
const session = useSession();
const personalDetails = usePersonalDetails();
const {getCurrencyDecimals} = useCurrencyListActions();
const {getCurrencyDecimals, getCurrencySymbol} = useCurrencyListActions();
const hasViolations = hasViolationsReportUtils(undefined, transactionViolations, session?.accountID ?? CONST.DEFAULT_NUMBER_ID, session?.email ?? '');
const firstTransactionKey = selectedTransactionsKeys.at(0);
const firstTransactionReportID = firstTransactionKey ? selectedTransactions[firstTransactionKey]?.reportID : undefined;
Expand Down Expand Up @@ -189,6 +189,7 @@ function SearchTransactionsChangeReport() {
selfDMReportActions,
delegateAccountID,
getCurrencyDecimals,
getCurrencySymbol,
});
clearSelectedTransactions();
});
Expand Down Expand Up @@ -280,6 +281,7 @@ function SearchTransactionsChangeReport() {
selfDMReportActions,
delegateAccountID,
getCurrencyDecimals,
getCurrencySymbol,
});
Navigation.goBack(undefined, {afterTransition: clearSelectedTransactions});
};
Expand All @@ -304,6 +306,7 @@ function SearchTransactionsChangeReport() {
selfDMReportActions,
delegateAccountID,
getCurrencyDecimals,
getCurrencySymbol,
});
clearSelectedTransactions();
Navigation.goBack();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ function DynamicIOURequestEditReport({route}: DynamicIOURequestEditReportProps)
const [selfDMReportID] = useOnyx(ONYXKEYS.SELF_DM_REPORT_ID);
const [selfDMReportActions] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${getNonEmptyStringOnyxID(selfDMReportID)}`);
const [isTrackIntentUser] = useOnyx(ONYXKEYS.NVP_INTRO_SELECTED, {selector: isTrackIntentUserSelector});
const {getCurrencyDecimals} = useCurrencyListActions();
const {getCurrencyDecimals, getCurrencySymbol} = useCurrencyListActions();
const selectReport = (item: TransactionGroupListItem, report?: OnyxEntry<Report>) => {
if (transactionIDs.length === 0 || item.value === reportID) {
Navigation.dismissToSuperWideRHP();
Expand Down Expand Up @@ -125,6 +125,7 @@ function DynamicIOURequestEditReport({route}: DynamicIOURequestEditReportProps)
selfDMReportActions,
delegateAccountID,
getCurrencyDecimals,
getCurrencySymbol,
});
turnOffMobileSelectionMode();
clearSelectedTransactions(true);
Expand Down Expand Up @@ -153,6 +154,7 @@ function DynamicIOURequestEditReport({route}: DynamicIOURequestEditReportProps)
selfDMReportActions,
delegateAccountID,
getCurrencyDecimals,
getCurrencySymbol,
});
if (shouldTurnOffSelectionMode) {
turnOffMobileSelectionMode();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ function DynamicIOURequestStepUpgrade({
const [selfDMReportID] = useOnyx(ONYXKEYS.SELF_DM_REPORT_ID);
const [selfDMReportActions] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${getNonEmptyStringOnyxID(selfDMReportID)}`);
const isTrackIntentUser = isTrackOnboardingChoice(introSelected?.choice);
const {getCurrencyDecimals} = useCurrencyListActions();
const {getCurrencyDecimals, getCurrencySymbol} = useCurrencyListActions();

// Search-selected transactions are not in COLLECTION.TRANSACTION — extract from `selectedTransactions` directly.
const transactions = Object.values(selectedTransactions)
Expand Down Expand Up @@ -169,6 +169,7 @@ function DynamicIOURequestStepUpgrade({
personalPolicyOutputCurrency: undefined,
delegateAccountID,
getCurrencyDecimals,
getCurrencySymbol,
});

clearSelectedTransactions();
Expand Down Expand Up @@ -279,6 +280,7 @@ function DynamicIOURequestStepUpgrade({
isTrackIntentUser,
delegateAccountID,
getCurrencyDecimals,
getCurrencySymbol,
]);

const participant = transaction?.participants?.[0];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ function useReportSelectionActions({
const reports = useChangeTransactionsReportReports(transaction ? [transaction] : [], undefined);
const [isTrackIntentUser] = useOnyx(ONYXKEYS.NVP_INTRO_SELECTED, {selector: isTrackIntentUserSelector});
const delegateAccountID = useDelegateAccountID();
const {getCurrencyDecimals} = useCurrencyListActions();
const {getCurrencyDecimals, getCurrencySymbol} = useCurrencyListActions();

const targetTransactionIDs = transaction?.transactionID ? [transaction.transactionID] : [];
const targetTransactions = transaction ? [transaction] : [];
Expand Down Expand Up @@ -227,6 +227,7 @@ function useReportSelectionActions({
selfDMReportActions,
delegateAccountID,
getCurrencyDecimals,
getCurrencySymbol,
});
removeTransaction(transaction.transactionID);
}
Expand Down Expand Up @@ -256,6 +257,7 @@ function useReportSelectionActions({
selfDMReportActions,
delegateAccountID,
getCurrencyDecimals,
getCurrencySymbol,
});
removeTransaction(transaction.transactionID);
},
Expand Down
11 changes: 5 additions & 6 deletions tests/actions/IOU/MoneyRequestSettersTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import {
setMoneyRequestTag,
} from '@libs/actions/IOU/MoneyRequest';
import initOnyxDerivedValues from '@libs/actions/OnyxDerived';
import {getCurrencyDecimals} from '@libs/CurrencyUtils';
import Log from '@libs/Log';
import type * as PolicyUtils from '@libs/PolicyUtils';

Expand All @@ -34,7 +33,7 @@ import createRandomPolicy, {createCategoryTaxExpenseRules} from '../../utils/col
import {createRandomReport} from '../../utils/collections/reports';
import createRandomTransaction from '../../utils/collections/transaction';
import getOnyxValue from '../../utils/getOnyxValue';
import {getGlobalFetchMock} from '../../utils/TestHelper';
import {getCurrencyDecimalsLocal, getGlobalFetchMock} from '../../utils/TestHelper';
import waitForBatchedUpdates from '../../utils/waitForBatchedUpdates';

const topMostReportID = '23423423';
Expand Down Expand Up @@ -357,7 +356,7 @@ describe('actions/IOU', () => {
await Onyx.merge(`${ONYXKEYS.COLLECTION.POLICY}${policyID}`, fakePolicy);

// When setting the money request category
setMoneyRequestCategory(transactionID, category, fakePolicy, getCurrencyDecimals);
setMoneyRequestCategory(transactionID, category, fakePolicy, getCurrencyDecimalsLocal);

await waitForBatchedUpdates();

Expand Down Expand Up @@ -398,7 +397,7 @@ describe('actions/IOU', () => {
await Onyx.merge(`${ONYXKEYS.COLLECTION.POLICY}${policyID}`, fakePolicy);

// When setting the money request category
setMoneyRequestCategory(transactionID, category, fakePolicy, getCurrencyDecimals);
setMoneyRequestCategory(transactionID, category, fakePolicy, getCurrencyDecimalsLocal);

await waitForBatchedUpdates();

Expand Down Expand Up @@ -436,7 +435,7 @@ describe('actions/IOU', () => {
await Onyx.merge(`${ONYXKEYS.COLLECTION.POLICY}${policyID}`, fakePolicy);

// When setting the money request category
setMoneyRequestCategory(transactionID, category, fakePolicy, getCurrencyDecimals);
setMoneyRequestCategory(transactionID, category, fakePolicy, getCurrencyDecimalsLocal);

await waitForBatchedUpdates();

Expand Down Expand Up @@ -467,7 +466,7 @@ describe('actions/IOU', () => {
});

// When setting the money request category without a policyID
setMoneyRequestCategory(transactionID, '', undefined, getCurrencyDecimals);
setMoneyRequestCategory(transactionID, '', undefined, getCurrencyDecimalsLocal);
await waitForBatchedUpdates();

// Then the transaction tax should be cleared
Expand Down
Loading
Loading