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
2 changes: 1 addition & 1 deletion Mobile-Expensify
4 changes: 2 additions & 2 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,8 @@ android {
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
multiDexEnabled rootProject.ext.multiDexEnabled
versionCode 1009039002
versionName "9.3.90-2"
versionCode 1009039003
versionName "9.3.90-3"
// Supported language variants must be declared here to avoid from being removed during the compilation.
// This also helps us to not include unnecessary language variants in the APK.
resConfigs "en", "es"
Expand Down
2 changes: 1 addition & 1 deletion ios/NewExpensify/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
</dict>
</array>
<key>CFBundleVersion</key>
<string>9.3.90.2</string>
<string>9.3.90.3</string>
<key>FullStory</key>
<dict>
<key>OrgId</key>
Expand Down
2 changes: 1 addition & 1 deletion ios/NotificationServiceExtension/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<key>CFBundleShortVersionString</key>
<string>9.3.90</string>
<key>CFBundleVersion</key>
<string>9.3.90.2</string>
<string>9.3.90.3</string>
<key>NSExtension</key>
<dict>
<key>NSExtensionPointIdentifier</key>
Expand Down
2 changes: 1 addition & 1 deletion ios/ShareViewController/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<key>CFBundleShortVersionString</key>
<string>9.3.90</string>
<key>CFBundleVersion</key>
<string>9.3.90.2</string>
<string>9.3.90.3</string>
<key>NSExtension</key>
<dict>
<key>NSExtensionAttributes</key>
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "new.expensify",
"version": "9.3.90-2",
"version": "9.3.90-3",
Comment thread
inimaga marked this conversation as resolved.
"author": "Expensify, Inc.",
"homepage": "https://new.expensify.com",
"description": "New Expensify is the next generation of Expensify: a reimagination of payments based atop a foundation of chat.",
Expand Down
183 changes: 63 additions & 120 deletions src/hooks/useSearchBulkActions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import type {PaymentMethodType} from '@components/KYCWall/types';
import {ModalActions} from '@components/Modal/Global/ModalContext';
import type {PopoverMenuItem} from '@components/PopoverMenu';
import {useSearchQueryContext, useSearchResultsContext, useSearchSelectionActions, useSearchSelectionContext} from '@components/Search/SearchContext';
import type {BulkPaySelectionData, PaymentData, SearchColumnType, SearchQueryJSON} from '@components/Search/types';
import type {BulkPaySelectionData, PaymentData, SearchQueryJSON} from '@components/Search/types';
import {unholdRequest} from '@libs/actions/IOU/Hold';
import {setupMergeTransactionDataAndNavigate} from '@libs/actions/MergeTransaction';
import {deleteAppReport, exportReportToPDF, markAsManuallyExported, moveIOUReportToPolicy, moveIOUReportToPolicyAndInviteSubmitter} from '@libs/actions/Report';
Expand Down Expand Up @@ -51,8 +51,8 @@ import {
isIOUReport as isIOUReportUtil,
isSelfDM,
} from '@libs/ReportUtils';
import {isDefaultExpensesQuery, serializeQueryJSONForBackend} from '@libs/SearchQueryUtils';
import {getColumnsToShow, getSearchColumnTranslationKey, getValidGroupBy, navigateToSearchRHP, shouldShowDeleteOption} from '@libs/SearchUIUtils';
import {serializeQueryJSONForBackend} from '@libs/SearchQueryUtils';
import {navigateToSearchRHP, shouldShowDeleteOption} from '@libs/SearchUIUtils';
import {shouldRestrictUserBillableActions} from '@libs/SubscriptionUtils';
import {
getOriginalTransactionWithSplitInfo,
Expand All @@ -73,7 +73,6 @@ import {canIOUBePaid} from '@userActions/IOU/ReportWorkflow';
import CONST from '@src/CONST';
import ONYXKEYS from '@src/ONYXKEYS';
import ROUTES from '@src/ROUTES';
import {columnsSelector} from '@src/selectors/AdvancedSearchFiltersForm';
import type {BillingGraceEndPeriod, Policy, Report, ReportNameValuePairs, SearchResults, Transaction, TransactionViolations} from '@src/types/onyx';
import type DeepValueOf from '@src/types/utils/DeepValueOf';
import useAllPolicyExpenseChatReportActions from './useAllPolicyExpenseChatReportActions';
Expand Down Expand Up @@ -276,7 +275,6 @@ function useSearchBulkActions({queryJSON}: UseSearchBulkActionsParams) {
const [integrationsExportTemplates] = useOnyx(ONYXKEYS.NVP_INTEGRATION_SERVER_EXPORT_TEMPLATES);
const [csvExportLayouts] = useOnyx(ONYXKEYS.NVP_CSV_EXPORT_LAYOUTS);
const [transactions] = useOnyx(ONYXKEYS.COLLECTION.TRANSACTION);
const [visibleColumns] = useOnyx(ONYXKEYS.FORMS.SEARCH_ADVANCED_FILTERS_FORM, {selector: columnsSelector});
const [allTransactionViolations] = useOnyx(ONYXKEYS.COLLECTION.TRANSACTION_VIOLATIONS);
const [userBillingGracePeriodEnds] = useOnyx(ONYXKEYS.COLLECTION.SHARED_NVP_PRIVATE_USER_BILLING_GRACE_PERIOD_END);
const [amountOwed] = useOnyx(ONYXKEYS.NVP_PRIVATE_AMOUNT_OWED);
Expand Down Expand Up @@ -538,116 +536,74 @@ function useSearchBulkActions({queryJSON}: UseSearchBulkActionsParams) {
return result;
}, [policies]);

const exportSearchData = searchResults?.data;
const exportSearchType = searchResults?.search.type ?? queryJSON?.type;

const getCSVExportParameters = useCallback(
(isBasicExport: boolean) => {
const columnsToExport = getColumnsToShow({
currentAccountID: accountID,
data: exportSearchData ?? {},
visibleColumns,
type: exportSearchType,
groupBy: getValidGroupBy(queryJSON?.groupBy),
shouldUseStrictDefaultExpenseColumns: currentSearchKey === CONST.SEARCH.SEARCH_KEYS.EXPENSES && !!queryJSON && isDefaultExpensesQuery(queryJSON),
});

const exportColumnLabels: Partial<Record<SearchColumnType, string>> = {};
for (const column of columnsToExport) {
exportColumnLabels[column] = translate(getSearchColumnTranslationKey(column));
}

const jsonQuery = queryJSON ? serializeQueryJSONForBackend({...queryJSON, columns: columnsToExport as SearchQueryJSON['columns']}) : (JSON.stringify(queryJSON) ?? '');

return {
jsonQuery,
isBasicExport,
exportColumnLabels: JSON.stringify(exportColumnLabels),
};
},
[accountID, currentSearchKey, exportSearchData, exportSearchType, queryJSON, translate, visibleColumns],
);
const handleBasicExport = useCallback(async () => {
if (isOffline) {
setIsOfflineModalVisible(true);
return;
}

const handleCSVExport = useCallback(
async (isBasicExport: boolean) => {
if (isOffline) {
setIsOfflineModalVisible(true);
return;
}
if (status === null || status === undefined) {
return;
}

if (status === null || status === undefined) {
if (areAllMatchingItemsSelected) {
const result = await showConfirmModal({
title: translate('search.exportSearchResults.title'),
prompt: translate('search.exportSearchResults.description'),
confirmText: translate('search.exportSearchResults.title'),
cancelText: translate('common.cancel'),
});
if (result.action !== ModalActions.CONFIRM) {
return;
}

if (areAllMatchingItemsSelected) {
const result = await showConfirmModal({
title: translate('search.exportSearchResults.title'),
prompt: translate('search.exportSearchResults.description'),
confirmText: translate('search.exportSearchResults.title'),
cancelText: translate('common.cancel'),
});
if (result.action !== ModalActions.CONFIRM) {
return;
}
if (selectedTransactionsKeys.length === 0 || status == null || !hash) {
return;
}
const reportIDList = selectedReports?.map((report) => report?.reportID).filter((reportID) => reportID !== undefined) ?? [];
const exportParameters = getCSVExportParameters(isBasicExport);
queueExportSearchItemsToCSV({
query: status,
jsonQuery: exportParameters.jsonQuery,
reportIDList,
transactionIDList: selectedTransactionsKeys,
isBasicExport: exportParameters.isBasicExport,
exportColumnLabels: exportParameters.exportColumnLabels,
});
selectAllMatchingItems(false);
clearSelectedTransactions();
if (selectedTransactionsKeys.length === 0 || status == null || !hash) {
return;
}
const reportIDList = selectedReports?.map((report) => report?.reportID).filter((reportID) => reportID !== undefined) ?? [];
queueExportSearchItemsToCSV({
query: status,
jsonQuery: queryJSON ? serializeQueryJSONForBackend(queryJSON) : JSON.stringify(queryJSON),
reportIDList,
transactionIDList: selectedTransactionsKeys,
});
selectAllMatchingItems(false);
clearSelectedTransactions();
return;
}

let didFail = false;
const exportParameters = getCSVExportParameters(isBasicExport);
await exportSearchItemsToCSV(
{
query: status,
jsonQuery: exportParameters.jsonQuery,
reportIDList: selectedReports.length > 0 ? selectedReportIDs : selectedTransactionReportIDs,
transactionIDList: selectedTransactionsKeys,
isBasicExport: exportParameters.isBasicExport,
exportColumnLabels: exportParameters.exportColumnLabels,
},
() => {
didFail = true;
setEmptyReportsCount(0);
setIsDownloadErrorModalVisible(true);
},
translate,
);
if (!didFail) {
clearSelectedTransactions(undefined, true);
}
},
[
isOffline,
status,
areAllMatchingItemsSelected,
selectedReports,
selectedReportIDs,
selectedTransactionReportIDs,
selectedTransactionsKeys,
let didFail = false;
await exportSearchItemsToCSV(
{
query: status,
jsonQuery: queryJSON ? serializeQueryJSONForBackend(queryJSON) : JSON.stringify(queryJSON),
reportIDList: selectedReports.length > 0 ? selectedReportIDs : selectedTransactionReportIDs,
transactionIDList: selectedTransactionsKeys,
},
() => {
didFail = true;
setEmptyReportsCount(0);
setIsDownloadErrorModalVisible(true);
},
translate,
clearSelectedTransactions,
showConfirmModal,
hash,
selectAllMatchingItems,
getCSVExportParameters,
],
);

const handleBasicExport = useCallback(() => handleCSVExport(true), [handleCSVExport]);
const handleExportCurrentView = useCallback(() => handleCSVExport(false), [handleCSVExport]);
);
if (!didFail) {
clearSelectedTransactions(undefined, true);
}
}, [
isOffline,
status,
areAllMatchingItemsSelected,
queryJSON,
selectedReports,
selectedReportIDs,
selectedTransactionReportIDs,
selectedTransactionsKeys,
translate,
clearSelectedTransactions,
showConfirmModal,
hash,
selectAllMatchingItems,
]);

const handleApproveWithDEWCheck = useCallback(async () => {
if (isOffline) {
Expand Down Expand Up @@ -1087,7 +1043,6 @@ function useSearchBulkActions({queryJSON}: UseSearchBulkActionsParams) {
const areFullReportsSelected = selectedTransactionReportIDs.length === selectedReportIDs.length && selectedTransactionReportIDs.every((id) => selectedReportIDs.includes(id));
const typeInvoice = queryJSON?.type === CONST.REPORT.TYPE.INVOICE;
const typeExpense = queryJSON?.type === CONST.REPORT.TYPE.EXPENSE;
const isGroupedSearch = !!getValidGroupBy(queryJSON?.groupBy);
const isAllOneTransactionReport = Object.values(selectedTransactions).every((transaction) => transaction.isFromOneTransactionReport);

const includeReportLevelExport = ((isExpenseReportType || typeInvoice) && areFullReportsSelected) || (typeExpense && !isExpenseReportType && isAllOneTransactionReport);
Expand Down Expand Up @@ -1216,18 +1171,6 @@ function useSearchBulkActions({queryJSON}: UseSearchBulkActionsParams) {
shouldCallAfterModalHide: true,
});

if (!isGroupedSearch) {
exportOptions.push({
text: translate('export.currentView'),
icon: expensifyIcons.Table,
onSelected: () => {
handleExportCurrentView();
},
shouldCloseModalOnSelect: true,
shouldCallAfterModalHide: true,
});
}

if (!allSelectedAreDeleted) {
for (const template of exportTemplates) {
const isStandardTemplate =
Expand Down
1 change: 0 additions & 1 deletion src/languages/de.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9366,7 +9366,6 @@ Hier ist ein *Testbeleg*, um dir zu zeigen, wie es funktioniert:`,
expenseLevelExport: 'Alle Daten – Ausgabenebene',
exportInProgress: 'Export wird ausgeführt',
conciergeWillSend: 'Concierge wird dir die Datei in Kürze senden.',
currentView: 'Aktuelle Ansicht exportieren',
},
exportDownload: {
preparingTitle: 'Preparing download...',
Expand Down
1 change: 0 additions & 1 deletion src/languages/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9391,7 +9391,6 @@ const translations = {
},
export: {
basicExport: 'Basic export',
currentView: 'Export current view',
reportLevelExport: 'All Data - report level',
expenseLevelExport: 'All Data - expense level',
exportInProgress: 'Export in progress',
Expand Down
1 change: 0 additions & 1 deletion src/languages/es.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9519,7 +9519,6 @@ ${amount} para ${merchant} - ${date}`,
},
export: {
basicExport: 'Exportar básico',
currentView: 'Exportar vista actual',
reportLevelExport: 'Todos los datos - a nivel de informe',
expenseLevelExport: 'Todos los datos - a nivel de gasto',
exportInProgress: 'Exportación en curso',
Expand Down
1 change: 0 additions & 1 deletion src/languages/fr.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9397,7 +9397,6 @@ Voici un *reçu test* pour vous montrer comment ça fonctionne :`,
expenseLevelExport: 'Toutes les données - niveau dépense',
exportInProgress: 'Export en cours',
conciergeWillSend: 'Concierge vous enverra le fichier sous peu.',
currentView: 'Exporter la vue actuelle',
},
exportDownload: {
preparingTitle: 'Preparing download...',
Expand Down
1 change: 0 additions & 1 deletion src/languages/it.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9353,7 +9353,6 @@ Ecco una *ricevuta di prova* per mostrarti come funziona:`,
expenseLevelExport: 'Tutti i dati - livello spesa',
exportInProgress: 'Esportazione in corso',
conciergeWillSend: 'Concierge ti invierà il file a breve.',
currentView: 'Esporta vista corrente',
},
exportDownload: {
preparingTitle: 'Preparing download...',
Expand Down
1 change: 0 additions & 1 deletion src/languages/ja.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9235,7 +9235,6 @@ ${reportName}
expenseLevelExport: 'すべてのデータ - 経費レベル',
exportInProgress: 'エクスポート処理中',
conciergeWillSend: 'Conciergeがまもなくファイルを送信します。',
currentView: '現在の表示をエクスポート',
},
exportDownload: {
preparingTitle: 'Preparing download...',
Expand Down
1 change: 0 additions & 1 deletion src/languages/nl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9322,7 +9322,6 @@ Hier is een *proefbon* om je te laten zien hoe het werkt:`,
expenseLevelExport: 'Alle gegevens - uitgaveniveau',
exportInProgress: 'Export bezig',
conciergeWillSend: 'Concierge stuurt je het bestand zo meteen.',
currentView: 'Huidige weergave exporteren',
},
exportDownload: {
preparingTitle: 'Preparing download...',
Expand Down
1 change: 0 additions & 1 deletion src/languages/pl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9303,7 +9303,6 @@ Oto *paragon testowy*, żeby pokazać Ci, jak to działa:`,
expenseLevelExport: 'Wszystkie dane – poziom wydatku',
exportInProgress: 'Trwa eksport',
conciergeWillSend: 'Concierge wkrótce wyśle Ci plik.',
currentView: 'Eksportuj bieżący widok',
},
exportDownload: {
preparingTitle: 'Preparing download...',
Expand Down
1 change: 0 additions & 1 deletion src/languages/pt-BR.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9312,7 +9312,6 @@ Aqui está um *comprovante de teste* para mostrar como funciona:`,
expenseLevelExport: 'Todos os dados - nível de despesa',
exportInProgress: 'Exportação em andamento',
conciergeWillSend: 'O Concierge enviará o arquivo para você em breve.',
currentView: 'Exportar visualização atual',
},
exportDownload: {
preparingTitle: 'Preparing download...',
Expand Down
1 change: 0 additions & 1 deletion src/languages/zh-hans.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9064,7 +9064,6 @@ ${reportName}
expenseLevelExport: '所有数据 - 报销级别',
exportInProgress: '导出进行中',
conciergeWillSend: 'Concierge 将很快把文件发送给你。',
currentView: '导出当前视图',
},
exportDownload: {
preparingTitle: 'Preparing download...',
Expand Down
2 changes: 0 additions & 2 deletions src/libs/API/parameters/ExportSearchItemsToCSVParams.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ type ExportSearchItemsToCSVParams = {
jsonQuery: SearchQueryString;
reportIDList: string[];
transactionIDList: string[];
isBasicExport: boolean;
exportColumnLabels: string;
};

export default ExportSearchItemsToCSVParams;
Loading
Loading