Commit 25e359c
committed
Optimistically update original report totals when moving held expenses to a new hold report
When a user partially approves or pays an expense report offline, the held
transactions are reassigned to a new hold report inside
getReportFromHoldRequestsOnyxData, but the original report's total and
nonReimbursableTotal fields were never updated. As a result, after the
optimistic merge the original report still carried its pre-move total while
hasHeldExpenses returned false, causing getTotalAmountForIOUReportPreviewButton
to fall through to reimbursableSpend derived from the stale total and display
the wrong Pay amount.
This change updates the original iouReport's total and nonReimbursableTotal to
the previously-stored unheld amounts whenever the utility actually moved any
held transactions, and adds a matching failure rollback. Because both the
approve and pay partial flows share this utility, both inherit the fix.
unheldTotal is intentionally left unchanged — after the move, every remaining
transaction is unheld, so the existing unheldTotal value already equals the
new total.1 parent 897ef5c commit 25e359c
1 file changed
Lines changed: 30 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4686 | 4686 | | |
4687 | 4687 | | |
4688 | 4688 | | |
| 4689 | + | |
| 4690 | + | |
| 4691 | + | |
| 4692 | + | |
| 4693 | + | |
| 4694 | + | |
| 4695 | + | |
| 4696 | + | |
4689 | 4697 | | |
4690 | 4698 | | |
4691 | 4699 | | |
| |||
4745 | 4753 | | |
4746 | 4754 | | |
4747 | 4755 | | |
| 4756 | + | |
| 4757 | + | |
| 4758 | + | |
| 4759 | + | |
| 4760 | + | |
| 4761 | + | |
| 4762 | + | |
| 4763 | + | |
| 4764 | + | |
| 4765 | + | |
| 4766 | + | |
4748 | 4767 | | |
4749 | 4768 | | |
4750 | 4769 | | |
| |||
4815 | 4834 | | |
4816 | 4835 | | |
4817 | 4836 | | |
| 4837 | + | |
| 4838 | + | |
| 4839 | + | |
| 4840 | + | |
| 4841 | + | |
| 4842 | + | |
| 4843 | + | |
| 4844 | + | |
| 4845 | + | |
| 4846 | + | |
| 4847 | + | |
4818 | 4848 | | |
4819 | 4849 | | |
4820 | 4850 | | |
| |||
0 commit comments