diff --git a/CHANGELOG.md b/CHANGELOG.md index 613fb9ed..067462ea 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ * *BREAKING* Update stripes-* dependencies to latest version. Refs UICIRC-1176. * Add seven new item-level tokens to "Pick slip" staff slip. Fixes UICIRC-1169. * Refactor RulesEditor away from componentWillReceiveProps. Refs UICIRC-431. +* Make `Consortium title level request` settings available only in Central tenant. Refs UICIRC-1192. ## [10.0.1](https://github.com/folio-org/ui-circulation/tree/v10.0.1) (2024-12-04) [Full Changelog](https://github.com/folio-org/ui-circulation/compare/v10.0.0...v10.0.1) diff --git a/src/index.js b/src/index.js index aef8d5d7..47064b96 100644 --- a/src/index.js +++ b/src/index.js @@ -33,12 +33,13 @@ class Circulation extends Component { intl: PropTypes.object.isRequired, } - constructor(props) { - super(props); + getSections() { + const { + stripes, + } = this.props; + const isEnabledEcsRequests = stripes?.config?.enableEcsRequests; - const isEnabledEcsRequests = props.stripes?.config?.enableEcsRequests; - - this.sections = [ + const sections = [ { label: , pages: [ @@ -113,7 +114,7 @@ class Circulation extends Component { }, { route: 'patron-notices', - label: this.props.intl.formatMessage({ id: 'ui-circulation.settings.index.patronNotices' }), + label: , component: PatronNotices, perm: 'ui-circulation.settings.view-notice-templates', }, @@ -151,7 +152,7 @@ class Circulation extends Component { ]; if (isEnabledEcsRequests === true) { - this.sections[0].pages.push({ + sections[0].pages.push({ route: 'title-level-requests', label: , component: TitleLevelRequests, @@ -161,30 +162,33 @@ class Circulation extends Component { route: 'consortium-title-level-requests', label: , component: ConsortiumTLR, - perm: getConsortiumTlrPermission(props.stripes), + perm: getConsortiumTlrPermission(stripes), }); - this.sections[4].pages.splice(2, 0, { + sections[4].pages.splice(2, 0, { route: 'tlr-patron-notice-templates', label: , component: TLRPatronNotices, perm: 'ui-circulation.settings.view-titleLevelRequests', }); } else { - this.sections[4].pages.splice(2, 0, { + sections[4].pages.splice(2, 0, { route: 'title-level-requests', label: , component: DeprecatedTitleLevelRequests, perm: 'ui-circulation.settings.view-titleLevelRequests', }); } + + return sections; } render() { return ( } /> diff --git a/src/settings/utils/utils.js b/src/settings/utils/utils.js index da395eed..e9425d22 100644 --- a/src/settings/utils/utils.js +++ b/src/settings/utils/utils.js @@ -5,6 +5,10 @@ import { get, } from 'lodash'; +import { + checkIfUserInCentralTenant, +} from '@folio/stripes/core'; + export const LAYERS = { EDIT: 'edit', CLONE: 'clone', @@ -95,7 +99,7 @@ export const getRecordName = ({ }; export const getConsortiumTlrPermission = (stripes) => { - if (stripes.hasInterface('consortia') && stripes.hasInterface('ecs-tlr')) { + if (stripes.hasInterface('consortia') && stripes.hasInterface('ecs-tlr') && checkIfUserInCentralTenant(stripes)) { return 'tlr.consortium-tlr.view'; }