Skip to content

Commit

Permalink
Merge pull request #26865 from Expensify/alberto-checkNone
Browse files Browse the repository at this point in the history
Improve empty merchant check for error
  • Loading branch information
mountiny authored Sep 6, 2023
2 parents 57b7606 + 137c3a2 commit 2816aad
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/components/ReportActionItem/MoneyRequestView.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@ function MoneyRequestView({report, parentReport, shouldShowHorizontalRule, trans
comment: transactionDescription,
merchant: transactionMerchant,
} = ReportUtils.getTransactionDetails(transaction);
const isEmptyMerchant =
transactionMerchant === '' || transactionMerchant === CONST.TRANSACTION.UNKNOWN_MERCHANT || transactionMerchant === CONST.TRANSACTION.PARTIAL_TRANSACTION_MERCHANT;
const formattedTransactionAmount = transactionAmount && transactionCurrency && CurrencyUtils.convertToDisplayString(transactionAmount, transactionCurrency);

const isSettled = ReportUtils.isSettled(moneyRequestReport.reportID);
Expand Down Expand Up @@ -158,8 +160,8 @@ function MoneyRequestView({report, parentReport, shouldShowHorizontalRule, trans
shouldShowRightIcon={canEdit}
titleStyle={styles.flex1}
onPress={() => Navigation.navigate(ROUTES.getEditRequestRoute(report.reportID, CONST.EDIT_REQUEST_FIELD.MERCHANT))}
brickRoadIndicator={hasErrors && transactionMerchant === CONST.TRANSACTION.UNKNOWN_MERCHANT ? CONST.BRICK_ROAD_INDICATOR_STATUS.ERROR : ''}
subtitle={hasErrors && transactionMerchant === CONST.TRANSACTION.UNKNOWN_MERCHANT ? translate('common.error.enterMerchant') : ''}
brickRoadIndicator={hasErrors && isEmptyMerchant ? CONST.BRICK_ROAD_INDICATOR_STATUS.ERROR : ''}
subtitle={hasErrors && isEmptyMerchant ? translate('common.error.enterMerchant') : ''}
subtitleTextStyle={styles.textLabelError}
/>
</OfflineWithFeedback>
Expand Down
1 change: 1 addition & 0 deletions src/libs/TransactionUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ function hasReceipt(transaction) {
function areRequiredFieldsEmpty(transaction) {
return (
transaction.modifiedMerchant === CONST.TRANSACTION.UNKNOWN_MERCHANT ||
transaction.modifiedMerchant === CONST.TRANSACTION.PARTIAL_TRANSACTION_MERCHANT ||
(transaction.modifiedMerchant === '' &&
(transaction.merchant === CONST.TRANSACTION.UNKNOWN_MERCHANT || transaction.merchant === '' || transaction.merchant === CONST.TRANSACTION.PARTIAL_TRANSACTION_MERCHANT)) ||
(transaction.modifiedAmount === 0 && transaction.amount === 0) ||
Expand Down

0 comments on commit 2816aad

Please sign in to comment.