-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
Fix the incorrect payer name on the non-reimbursable transaction #37773
Changes from all commits
3f7d952
e043a78
38c263d
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 |
---|---|---|
|
@@ -2130,8 +2130,7 @@ function getMoneyRequestReportName(report: OnyxEntry<Report>, policy: OnyxEntry< | |
|
||
const moneyRequestTotal = getMoneyRequestSpendBreakdown(report).totalDisplaySpend; | ||
const formattedAmount = CurrencyUtils.convertToDisplayString(moneyRequestTotal, report?.currency); | ||
const payerOrApproverName = | ||
isExpenseReport(report) && !hasNonReimbursableTransactions(report?.reportID ?? '') ? getPolicyName(report, false, policy) : getDisplayNameForParticipant(report?.managerID) ?? ''; | ||
let payerOrApproverName = isExpenseReport(report) ? getPolicyName(report, false, policy) : getDisplayNameForParticipant(report?.managerID) ?? ''; | ||
const payerPaidAmountMessage = Localize.translateLocal('iou.payerPaidAmount', { | ||
payer: payerOrApproverName, | ||
amount: formattedAmount, | ||
|
@@ -2148,7 +2147,8 @@ function getMoneyRequestReportName(report: OnyxEntry<Report>, policy: OnyxEntry< | |
return `${payerPaidAmountMessage} • ${Localize.translateLocal('iou.pending')}`; | ||
} | ||
|
||
if (hasNonReimbursableTransactions(report?.reportID)) { | ||
if (!isSettled(report?.reportID) && hasNonReimbursableTransactions(report?.reportID)) { | ||
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. An issue I stumbled upon while working on the PR is that after the non-reimbursable transaction is paid and clicking on the report preview, the money report header still shows Screen.Recording.2024-03-05.at.21.33.16.mp4So adding the check if the transaction paid shows the |
||
payerOrApproverName = getDisplayNameForParticipant(report?.ownerAccountID) ?? ''; | ||
return Localize.translateLocal('iou.payerSpentAmount', {payer: payerOrApproverName, amount: formattedAmount}); | ||
} | ||
|
||
|
@@ -2461,7 +2461,7 @@ function getReportPreviewMessage( | |
const containsNonReimbursable = hasNonReimbursableTransactions(report.reportID); | ||
const totalAmount = getMoneyRequestSpendBreakdown(report).totalDisplaySpend; | ||
const policyName = getPolicyName(report, false, policy); | ||
const payerName = isExpenseReport(report) && !containsNonReimbursable ? policyName : getDisplayNameForParticipant(report.managerID, !isPreviewMessageForParentChatReport); | ||
const payerName = isExpenseReport(report) ? policyName : getDisplayNameForParticipant(report.managerID, !isPreviewMessageForParentChatReport); | ||
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. 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. Yes, I believe so! @grgia Do you mind confirming if the above result is correct? |
||
|
||
const formattedAmount = CurrencyUtils.convertToDisplayString(totalAmount, report.currency); | ||
|
||
|
@@ -2541,10 +2541,10 @@ function getReportPreviewMessage( | |
} | ||
|
||
if (containsNonReimbursable) { | ||
return Localize.translateLocal('iou.payerSpentAmount', {payer: payerName ?? '', amount: formattedAmount}); | ||
return Localize.translateLocal('iou.payerSpentAmount', {payer: getDisplayNameForParticipant(report.ownerAccountID) ?? '', amount: formattedAmount}); | ||
} | ||
|
||
return Localize.translateLocal('iou.payerOwesAmount', {payer: payerName ?? '', amount: formattedAmount, comment}); | ||
return Localize.translateLocal('iou.payerOwesAmount', {payer: payerName ?? '', amount: formattedAmount}); | ||
} | ||
|
||
/** | ||
|
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.
The check
!hasNonReimbursableTransactions
is not needed here, so that's why I using the previous variable to get the payer name.