-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Revert "fix: pass workspace policyID when exporting with account-level custom templates" #93091
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -551,22 +551,14 @@ function useSearchBulkActions({queryJSON}: UseSearchBulkActionsParams) { | |
| } | ||
| const serializedQuery = queryJSON ? serializeQueryJSONForBackend(queryJSON) : JSON.stringify(queryJSON); | ||
|
|
||
| // Only fall back to the selection's policyID when every selected transaction belongs to the same real workspace. | ||
| // selectedPolicyIDs filters out falsy policyIDs, so a mix of one workspace expense and policy-less (personal/unreported) | ||
| // expenses would otherwise collapse to a single ID and incorrectly resolve GL codes against that workspace. | ||
| const allSelectedHavePolicy = Object.values(selectedTransactions).every((transaction) => !!transaction.policyID); | ||
| const selectedPolicyID = allSelectedHavePolicy && selectedPolicyIDs.length === 1 ? selectedPolicyIDs.at(0) : undefined; | ||
| const queryPolicyID = queryJSON?.policyID?.length === 1 ? queryJSON.policyID.at(0) : undefined; | ||
| const exportPolicyID = policyID ?? (areAllMatchingItemsSelected ? queryPolicyID : selectedPolicyID); | ||
|
|
||
| if (areAllMatchingItemsSelected) { | ||
| queueExportSearchWithTemplate({ | ||
| templateName, | ||
| templateType, | ||
| jsonQuery: serializedQuery, | ||
| reportIDList: [], | ||
| transactionIDList: [], | ||
| policyID: exportPolicyID, | ||
| policyID, | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
When users choose an account-level custom template from search, Useful? React with 👍 / 👎.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's a straight revert |
||
| }); | ||
| } else { | ||
| const isGroupExport = !!queryJSON?.groupBy && selectedTransactionsKeys.some((key) => key.startsWith(CONST.SEARCH.GROUP_PREFIX)); | ||
|
|
@@ -576,7 +568,7 @@ function useSearchBulkActions({queryJSON}: UseSearchBulkActionsParams) { | |
| jsonQuery: isGroupExport ? serializeQueryJSONForBackend(addSelectedGroupsFilter(queryJSON, selectedTransactions, currentSearchResults?.data)) : '{}', | ||
| reportIDList: isGroupExport ? [] : selectedTransactionReportIDs, | ||
| transactionIDList: isGroupExport ? [] : selectedTransactionsKeys, | ||
| policyID: exportPolicyID, | ||
| policyID, | ||
| }); | ||
| } | ||
|
|
||
|
|
@@ -603,7 +595,6 @@ function useSearchBulkActions({queryJSON}: UseSearchBulkActionsParams) { | |
| queryJSON, | ||
| selectedTransactionReportIDs, | ||
| selectedTransactionsKeys, | ||
| selectedPolicyIDs, | ||
| ], | ||
| ); | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For account-level in-app templates,
getExportTemplatescreates entries withouttemplate.policyID, so this call now sendspolicyID: undefinedwhenever a user exports a workspace report with one of those templates. The backend no longer has the workspace context needed to resolve policy fields/GL codes, so account-level custom template exports from the report menu produce incorrect or missing workspace-specific columns; the selection-toolbar path still passespolicy?.idfor the same API call.Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It;s a straight revert