Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CP Staging] Fix/36574: Add condition to check required merchant #36810

Merged
merged 2 commits into from
Feb 19, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading