Skip to content

Commit

Permalink
Merge pull request #34216 from dukenv0307/fix/34029
Browse files Browse the repository at this point in the history
Display merchant in report name of transaction report if exist
  • Loading branch information
blimpich authored Jan 23, 2024
2 parents cfea515 + e9ca21b commit d8fb3f4
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/libs/ReportUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2155,7 +2155,7 @@ function getTransactionReportName(reportAction: OnyxEntry<ReportAction>): string

return Localize.translateLocal(ReportActionsUtils.isSentMoneyReportAction(reportAction) ? 'iou.threadSentMoneyReportName' : 'iou.threadRequestReportName', {
formattedAmount: CurrencyUtils.convertToDisplayString(transactionDetails?.amount ?? 0, transactionDetails?.currency, TransactionUtils.isDistanceRequest(transaction)) ?? '',
comment: transactionDetails?.comment ?? '',
comment: (!TransactionUtils.isMerchantMissing(transaction) ? transactionDetails?.merchant : transactionDetails?.comment) ?? '',
});
}

Expand Down
7 changes: 4 additions & 3 deletions src/libs/TransactionUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -141,11 +141,12 @@ function hasReceipt(transaction: Transaction | undefined | null): boolean {
}

function isMerchantMissing(transaction: Transaction) {
if (transaction.modifiedMerchant && transaction.modifiedMerchant !== '') {
return transaction.modifiedMerchant === CONST.TRANSACTION.PARTIAL_TRANSACTION_MERCHANT;
}
const isMerchantEmpty = transaction.merchant === CONST.TRANSACTION.PARTIAL_TRANSACTION_MERCHANT || transaction.merchant === '';

const isModifiedMerchantEmpty = !transaction.modifiedMerchant || transaction.modifiedMerchant === CONST.TRANSACTION.PARTIAL_TRANSACTION_MERCHANT || transaction.modifiedMerchant === '';

return isMerchantEmpty && isModifiedMerchantEmpty;
return isMerchantEmpty;
}

/**
Expand Down

0 comments on commit d8fb3f4

Please sign in to comment.