From 51813cc574e4b6d9d237cbb2c92faeab51b9ac63 Mon Sep 17 00:00:00 2001 From: Dylan Date: Tue, 20 Feb 2024 01:49:51 +0700 Subject: [PATCH 1/2] add condition to check merchant required --- src/pages/iou/request/step/IOURequestStepMerchant.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/pages/iou/request/step/IOURequestStepMerchant.js b/src/pages/iou/request/step/IOURequestStepMerchant.js index 914328ace125..7b17226d662b 100644 --- a/src/pages/iou/request/step/IOURequestStepMerchant.js +++ b/src/pages/iou/request/step/IOURequestStepMerchant.js @@ -17,6 +17,7 @@ import useThemeStyles from '@hooks/useThemeStyles'; import compose from '@libs/compose'; import Navigation from '@libs/Navigation/Navigation'; import * as ReportUtils from '@libs/ReportUtils'; +import reportPropTypes from '@pages/reportPropTypes'; import {policyPropTypes} from '@pages/workspace/withPolicy'; import * as IOU from '@userActions/IOU'; import CONST from '@src/CONST'; @@ -46,6 +47,9 @@ const propTypes = { /** Collection of tags attached to a policy */ policyTags: tagPropTypes, + + /** The report currently being looked at */ + report: reportPropTypes, }; const defaultProps = { @@ -54,6 +58,7 @@ const defaultProps = { policy: null, policyTags: null, policyCategories: null, + report: {}, }; function IOURequestStepMerchant({ @@ -65,6 +70,7 @@ function IOURequestStepMerchant({ policy, policyTags, policyCategories, + report, }) { const styles = useThemeStyles(); const {translate} = useLocalize(); @@ -75,7 +81,7 @@ function IOURequestStepMerchant({ const isEditingSplitBill = iouType === CONST.IOU.TYPE.SPLIT && isEditing; const {merchant} = ReportUtils.getTransactionDetails(isEditingSplitBill && !lodashIsEmpty(splitDraftTransaction) ? splitDraftTransaction : transaction); const isEmptyMerchant = merchant === '' || merchant === CONST.TRANSACTION.PARTIAL_TRANSACTION_MERCHANT; - const isMerchantRequired = _.some(transaction.participants, (participant) => Boolean(participant.isPolicyExpenseChat)); + const isMerchantRequired = _.some(transaction.participants, (participant) => Boolean(participant.isPolicyExpenseChat)) || ReportUtils.isGroupPolicy(report); const navigateBack = () => { Navigation.goBack(backTo); }; From 2638982a4b37bf65e2e11759880d0fc50b3b244e Mon Sep 17 00:00:00 2001 From: Dylan Date: Tue, 20 Feb 2024 03:07:58 +0700 Subject: [PATCH 2/2] add condition to check merchant required --- src/pages/iou/request/step/IOURequestStepMerchant.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/iou/request/step/IOURequestStepMerchant.js b/src/pages/iou/request/step/IOURequestStepMerchant.js index 7b17226d662b..98caea625981 100644 --- a/src/pages/iou/request/step/IOURequestStepMerchant.js +++ b/src/pages/iou/request/step/IOURequestStepMerchant.js @@ -81,7 +81,7 @@ function IOURequestStepMerchant({ const isEditingSplitBill = iouType === CONST.IOU.TYPE.SPLIT && isEditing; const {merchant} = ReportUtils.getTransactionDetails(isEditingSplitBill && !lodashIsEmpty(splitDraftTransaction) ? splitDraftTransaction : transaction); const isEmptyMerchant = merchant === '' || merchant === CONST.TRANSACTION.PARTIAL_TRANSACTION_MERCHANT; - const isMerchantRequired = _.some(transaction.participants, (participant) => Boolean(participant.isPolicyExpenseChat)) || ReportUtils.isGroupPolicy(report); + const isMerchantRequired = ReportUtils.isGroupPolicy(report) || _.some(transaction.participants, (participant) => Boolean(participant.isPolicyExpenseChat)); const navigateBack = () => { Navigation.goBack(backTo); };