Skip to content

Commit 5287161

Browse files
JulesssssOSBotify
authored andcommitted
Merge pull request #93091 from Expensify/revert-92131-fix/issue-89388
Revert "fix: pass workspace policyID when exporting with account-level custom templates" (cherry picked from commit 5f4c382) (cherry-picked to staging by Julesssss)
1 parent ba4e9ed commit 5287161

2 files changed

Lines changed: 3 additions & 12 deletions

File tree

src/hooks/useExportActions.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ function useExportActions({reportID, policy, onPDFModalOpen}: UseExportActionsPa
133133
jsonQuery: '{}',
134134
reportIDList: [moneyRequestReport.reportID],
135135
transactionIDList,
136-
policyID: policyID ?? moneyRequestReport.policyID,
136+
policyID,
137137
});
138138
};
139139

src/hooks/useSearchBulkActions.ts

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -551,22 +551,14 @@ function useSearchBulkActions({queryJSON}: UseSearchBulkActionsParams) {
551551
}
552552
const serializedQuery = queryJSON ? serializeQueryJSONForBackend(queryJSON) : JSON.stringify(queryJSON);
553553

554-
// Only fall back to the selection's policyID when every selected transaction belongs to the same real workspace.
555-
// selectedPolicyIDs filters out falsy policyIDs, so a mix of one workspace expense and policy-less (personal/unreported)
556-
// expenses would otherwise collapse to a single ID and incorrectly resolve GL codes against that workspace.
557-
const allSelectedHavePolicy = Object.values(selectedTransactions).every((transaction) => !!transaction.policyID);
558-
const selectedPolicyID = allSelectedHavePolicy && selectedPolicyIDs.length === 1 ? selectedPolicyIDs.at(0) : undefined;
559-
const queryPolicyID = queryJSON?.policyID?.length === 1 ? queryJSON.policyID.at(0) : undefined;
560-
const exportPolicyID = policyID ?? (areAllMatchingItemsSelected ? queryPolicyID : selectedPolicyID);
561-
562554
if (areAllMatchingItemsSelected) {
563555
queueExportSearchWithTemplate({
564556
templateName,
565557
templateType,
566558
jsonQuery: serializedQuery,
567559
reportIDList: [],
568560
transactionIDList: [],
569-
policyID: exportPolicyID,
561+
policyID,
570562
});
571563
} else {
572564
const isGroupExport = !!queryJSON?.groupBy && selectedTransactionsKeys.some((key) => key.startsWith(CONST.SEARCH.GROUP_PREFIX));
@@ -576,7 +568,7 @@ function useSearchBulkActions({queryJSON}: UseSearchBulkActionsParams) {
576568
jsonQuery: isGroupExport ? serializeQueryJSONForBackend(addSelectedGroupsFilter(queryJSON, selectedTransactions, currentSearchResults?.data)) : '{}',
577569
reportIDList: isGroupExport ? [] : selectedTransactionReportIDs,
578570
transactionIDList: isGroupExport ? [] : selectedTransactionsKeys,
579-
policyID: exportPolicyID,
571+
policyID,
580572
});
581573
}
582574

@@ -603,7 +595,6 @@ function useSearchBulkActions({queryJSON}: UseSearchBulkActionsParams) {
603595
queryJSON,
604596
selectedTransactionReportIDs,
605597
selectedTransactionsKeys,
606-
selectedPolicyIDs,
607598
],
608599
);
609600

0 commit comments

Comments
 (0)