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

UIQM-699 use member tenant id for validation when deriving a bib record (follow-up) #733

Merged
merged 1 commit into from
Sep 25, 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
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
Loading