Skip to content

Commit

Permalink
Merge pull request #36810 from DylanDylann/fix/36574
Browse files Browse the repository at this point in the history
Fix/36574: Add condition to check required merchant

(cherry picked from commit 6f1d8fa)
  • Loading branch information
bondydaa authored and OSBotify committed Feb 19, 2024
1 parent 2bf2d6e commit 8f328cb
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/pages/iou/request/step/IOURequestStepMerchant.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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 = {
Expand All @@ -54,6 +58,7 @@ const defaultProps = {
policy: null,
policyTags: null,
policyCategories: null,
report: {},
};

function IOURequestStepMerchant({
Expand All @@ -65,6 +70,7 @@ function IOURequestStepMerchant({
policy,
policyTags,
policyCategories,
report,
}) {
const styles = useThemeStyles();
const {translate} = useLocalize();
Expand All @@ -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 = ReportUtils.isGroupPolicy(report) || _.some(transaction.participants, (participant) => Boolean(participant.isPolicyExpenseChat));
const navigateBack = () => {
Navigation.goBack(backTo);
};
Expand Down

0 comments on commit 8f328cb

Please sign in to comment.