Skip to content

Commit

Permalink
show correct merchant
Browse files Browse the repository at this point in the history
  • Loading branch information
Gonals committed Sep 1, 2023
1 parent 46835eb commit aaa345b
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 8 deletions.
15 changes: 9 additions & 6 deletions src/components/ReportActionItem/ReportPreview.js
Original file line number Diff line number Diff line change
Expand Up @@ -120,12 +120,15 @@ function ReportPreview(props) {
const lastThreeTransactionsWithReceipts = ReportUtils.getReportPreviewDisplayTransactions(props.action);

const hasOnlyOneReceiptRequest = numberOfRequests === 1 && hasReceipts;
const previewSubtitle = hasOnlyOneReceiptRequest
? transactionsWithReceipts[0].merchant
: props.translate('iou.requestCount', {
count: numberOfRequests,
scanningReceipts: numberOfScanningReceipts,
});
let previewSubtitle = '';
if (hasOnlyOneReceiptRequest) {
previewSubtitle = transactionsWithReceipts[0].modifiedMerchant || transactionsWithReceipts[0].merchant;
} else {
previewSubtitle = props.translate('iou.requestCount', {
count: numberOfRequests,
scanningReceipts: numberOfScanningReceipts,
});
}

const getDisplayAmount = () => {
if (reportTotal) {
Expand Down
2 changes: 1 addition & 1 deletion src/libs/OptionsListUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,7 @@ function getAllReportErrors(report, reportActions) {
// Instead of adding all Smartscan errors, let's just add a generic error if there are any. This
// will be more performant and provide the same result in the UI
if (ReportUtils.hasMissingSmartscanFields(iouReportID)) {
_.extend(reportActionErrors, {createChat: ErrorUtils.getMicroSecondOnyxError('report.genericSmartscanFailureMessage')});
_.extend(reportActionErrors, {smartscan: ErrorUtils.getMicroSecondOnyxError('report.genericSmartscanFailureMessage')});
}
}
});
Expand Down
2 changes: 1 addition & 1 deletion src/libs/TransactionUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ function isReceiptBeingScanned(transaction) {
* @returns {Boolean}
*/
function hasMissingSmartscanFields(transaction) {
return hasReceipt(transaction) && !isReceiptBeingScanned(transaction) && !areRequiredFieldsPopulated(transaction);
return hasReceipt(transaction) && !isReceiptBeingScanned(transaction) && !areModifiedFieldsPopulated(transaction);
}

/**
Expand Down

0 comments on commit aaa345b

Please sign in to comment.