Skip to content

Commit

Permalink
Merge pull request #44721 from bernhardoj/fix/44126-merchant-is-requi…
Browse files Browse the repository at this point in the history
…red-in-invoice

Fix merchant is required when sending an invoice
  • Loading branch information
cristipaval authored Jul 8, 2024
2 parents d1c801a + a72642a commit a5fb7cd
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/components/MoneyRequestConfirmationList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ function MoneyRequestConfirmationList({
}, [isEditingSplitBill, hasSmartScanFailed, transaction, didConfirmSplit]);

const isMerchantEmpty = useMemo(() => !iouMerchant || TransactionUtils.isMerchantMissing(transaction), [transaction, iouMerchant]);
const isMerchantRequired = (isPolicyExpenseChat || isTypeInvoice) && (!isScanRequest || isEditingSplitBill) && shouldShowMerchant;
const isMerchantRequired = isPolicyExpenseChat && (!isScanRequest || isEditingSplitBill) && shouldShowMerchant;

const isCategoryRequired = !!policy?.requiresCategory;

Expand Down
3 changes: 1 addition & 2 deletions src/pages/iou/request/step/IOURequestStepMerchant.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,10 @@ function IOURequestStepMerchant({

// In the split flow, when editing we use SPLIT_TRANSACTION_DRAFT to save draft value
const isEditingSplitBill = iouType === CONST.IOU.TYPE.SPLIT && isEditing;
const isTypeInvoice = iouType === CONST.IOU.TYPE.INVOICE;
const merchant = ReportUtils.getTransactionDetails(isEditingSplitBill && !isEmptyObject(splitDraftTransaction) ? splitDraftTransaction : transaction)?.merchant;
const isEmptyMerchant = merchant === '' || merchant === CONST.TRANSACTION.PARTIAL_TRANSACTION_MERCHANT;

const isMerchantRequired = ReportUtils.isReportInGroupPolicy(report) || isTypeInvoice || transaction?.participants?.some((participant) => !!participant.isPolicyExpenseChat);
const isMerchantRequired = ReportUtils.isExpenseRequest(report) || transaction?.participants?.some((participant) => !!participant.isPolicyExpenseChat);

const navigateBack = () => {
Navigation.goBack(backTo);
Expand Down

0 comments on commit a5fb7cd

Please sign in to comment.