From b93a3882e5b0d7334063e6123447c5c4b7aeb099 Mon Sep 17 00:00:00 2001 From: Gandalf Date: Wed, 10 Jul 2024 19:23:32 +0530 Subject: [PATCH] fix logix for missing merchant --- .../MoneyRequestPreviewContent.tsx | 23 +++++++++++-------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/src/components/ReportActionItem/MoneyRequestPreview/MoneyRequestPreviewContent.tsx b/src/components/ReportActionItem/MoneyRequestPreview/MoneyRequestPreviewContent.tsx index 896432708aff..72c0fbd7c0e4 100644 --- a/src/components/ReportActionItem/MoneyRequestPreview/MoneyRequestPreviewContent.tsx +++ b/src/components/ReportActionItem/MoneyRequestPreview/MoneyRequestPreviewContent.tsx @@ -203,16 +203,19 @@ function MoneyRequestPreviewContent({ return `${message} ${CONST.DOT_SEPARATOR} ${isTooLong || hasViolationsAndFieldErrors ? translate('violations.reviewRequired') : violationMessage}`; } - - const isMerchantMissing = TransactionUtils.isMerchantMissing(transaction); - const isAmountMissing = TransactionUtils.isAmountMissing(transaction); - if (isAmountMissing && isMerchantMissing) { - message += ` ${CONST.DOT_SEPARATOR} ${translate('violations.reviewRequired')}`; - } else if (isAmountMissing) { - message += ` ${CONST.DOT_SEPARATOR} ${translate('iou.missingAmount')}`; - } else if (isMerchantMissing) { - message += ` ${CONST.DOT_SEPARATOR} ${translate('iou.missingMerchant')}`; - } else if (shouldShowHoldMessage) { + if (hasFieldErrors) { + const isMerchantMissing = TransactionUtils.isMerchantMissing(transaction); + const isAmountMissing = TransactionUtils.isAmountMissing(transaction); + if (isAmountMissing && isMerchantMissing) { + message += ` ${CONST.DOT_SEPARATOR} ${translate('violations.reviewRequired')}`; + } else if (isAmountMissing) { + message += ` ${CONST.DOT_SEPARATOR} ${translate('iou.missingAmount')}`; + } else if (isMerchantMissing) { + message += ` ${CONST.DOT_SEPARATOR} ${translate('iou.missingMerchant')}`; + } + return message; + } + if (shouldShowHoldMessage) { message += ` ${CONST.DOT_SEPARATOR} ${translate('violations.hold')}`; } } else if (hasNoticeTypeViolations && transaction && !ReportUtils.isReportApproved(iouReport) && !ReportUtils.isSettled(iouReport?.reportID)) {