Fix bulk pay option visibility for reports with foreign transaction currencies - #98964
Fix bulk pay option visibility for reports with foreign transaction currencies#98964emkhalid wants to merge 1 commit into
Conversation
|
@parasharrajat Please copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button] |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f9d5ed475c
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| selectedReports.length > 0 | ||
| ? selectedReports.map((report) => report.currency).filter(Boolean) | ||
| : Object.values(selectedTransactions) | ||
| .map((transaction) => transaction.currency) | ||
| .filter(Boolean); |
There was a problem hiding this comment.
Include remaining transaction currencies in mixed selections
When a user selects a full expense report and also individual expenses from another report, selectedReports is non-empty while selectedTransactions still contains the additional selected rows; getPayOption() explicitly allows that mixed selection via shouldShowBulkOptionForRemainingTransactions. This branch now builds selectedCurrencies only from the full reports, so a remaining selected expense in another currency is ignored and the Pay menu can offer a bank-account payment using the first report's currency instead of forcing Pay elsewhere for a mixed-currency bulk pay.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
When selectedReports is non-empty, bulk pay operates at the report level and only pays the reports in selectedReports (see itemsToPay in onBulkPaySelected).
Child transactions of selected reports always populate selectedTransactions. Combining transaction currencies with report currencies was the root cause of this bug, as foreign expense currencies on single-currency reports forced onlyShowPayElsewhere = true. Therefore, prioritizing selectedReports currencies when reports are selected is intentional and aligns with the approved proposal.
Explanation of Change
In
useSearchBulkActions,onlyShowPayElsewherecombined both report currencies and child transaction currencies intoselectedCurrencies. When reports with foreign purchase currencies were bulk-selected, this triggerednew Set(selectedCurrencies).size > 1, forcingonlyShowPayElsewheretotrueand hiding the "Pay with [bank account]" option even when all selected reports shared the same workspace output currency and had a verified business bank account connected.This fix updates
onlyShowPayElsewhereto check report currencies when reports are selected, and only falls back to child transaction currencies when only transactions are selected.Fixed Issues
$ #95832
PROPOSAL: #95832 (comment)
Tests
Pay with [bank account]option is displayed and not forced to onlyMark as paid.Pay with [bank account]option is still displayed and accessible.Offline tests
N/A
QA Steps
Same as tests
// TODO: These must be filled out, or the issue title must include "[No QA]."
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectionAvatar, I verified the components usingAvatarare working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))npm run compress-svg)Avataris modified, I verified thatAvataris working as expected in all cases)Designlabel and/or tagged@Expensify/designso the design team can review the changes.mainbranch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTeststeps.Screenshots/Videos
Android: Native
Android: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari
fix-demo.webm