Skip to content

Commit

Permalink
Merge pull request #37740 from bernhardoj/fix/37708-merchant-required…
Browse files Browse the repository at this point in the history
…-fields

Fix able to confirm split a scan request in policy expense chat even though the merchant is empty
  • Loading branch information
techievivek authored Mar 5, 2024
2 parents 73e96f7 + 9c7e765 commit 5199604
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/libs/TransactionUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,9 @@ function isCreatedMissing(transaction: Transaction) {
function areRequiredFieldsEmpty(transaction: Transaction): boolean {
const parentReport = allReports?.[`${ONYXKEYS.COLLECTION.REPORT}${transaction?.reportID}`] ?? null;
const isFromExpenseReport = parentReport?.type === CONST.REPORT.TYPE.EXPENSE;
return (isFromExpenseReport && isMerchantMissing(transaction)) || isAmountMissing(transaction) || isCreatedMissing(transaction);
const isSplitPolicyExpenseChat = !!transaction.comment?.splits?.some((participant) => allReports?.[`${ONYXKEYS.COLLECTION.REPORT}${participant.chatReportID}`]?.isOwnPolicyExpenseChat);
const isMerchantRequired = isFromExpenseReport || isSplitPolicyExpenseChat;
return (isMerchantRequired && isMerchantMissing(transaction)) || isAmountMissing(transaction) || isCreatedMissing(transaction);
}

/**
Expand Down

0 comments on commit 5199604

Please sign in to comment.