@@ -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