Skip to content

Commit

Permalink
UIQM-699 use member tenant id for validation when deriving a bib record
Browse files Browse the repository at this point in the history
  • Loading branch information
BogdanDenis committed Sep 24, 2024
1 parent b2009fe commit a722748
Showing 1 changed file with 1 addition and 10 deletions.
11 changes: 1 addition & 10 deletions src/QuickMarcEditor/QuickMarcDeriveWrapper.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,11 @@ import React, {
useMemo,
useState,
} from 'react';
import { useLocation } from 'react-router-dom';
import PropTypes from 'prop-types';
import flow from 'lodash/flow';
import isEmpty from 'lodash/isEmpty';

import { useShowCallout } from '@folio/stripes-acq-components';
import { useStripes } from '@folio/stripes/core';

import QuickMarcEditor from './QuickMarcEditor';
import {
Expand All @@ -37,7 +35,6 @@ import {
removeEnteredDate,
autopopulatePhysDescriptionField,
autopopulateMaterialCharsField,
applyCentralTenantInHeaders,
} from './utils';

const propTypes = {
Expand All @@ -59,17 +56,11 @@ const QuickMarcDeriveWrapper = ({
marcType,
fixedFieldSpec,
}) => {
const stripes = useStripes();
const location = useLocation();
const showCallout = useShowCallout();
const { linkableBibFields, actualizeLinks, linkingRules } = useAuthorityLinking({ marcType, action });
const [httpError, setHttpError] = useState(null);
const { validationErrorsRef } = useContext(QuickMarcContext);

const isRequestToCentralTenantFromMember = applyCentralTenantInHeaders(location, stripes, marcType);
const centralTenantId = stripes.user.user.consortium?.centralTenantId;
const tenantId = isRequestToCentralTenantFromMember ? centralTenantId : '';

const validationContext = useMemo(() => ({
initialValues,
marcType,
Expand All @@ -79,7 +70,7 @@ const QuickMarcDeriveWrapper = ({
fixedFieldSpec,
instanceId: instance.id,
}), [initialValues, marcType, linkableBibFields, linkingRules, fixedFieldSpec, instance.id]);
const { validate } = useValidation(validationContext, tenantId);
const { validate } = useValidation(validationContext);

const prepareForSubmit = useCallback((formValues) => {
const formValuesForDerive = flow(
Expand Down

0 comments on commit a722748

Please sign in to comment.