From ba6b0db452e7d50a7acdd0a4590da924a2d8839c Mon Sep 17 00:00:00 2001 From: Yury Saukou Date: Tue, 10 Oct 2023 23:53:18 +0400 Subject: [PATCH] UIIN-2614 Provide an instance tenantId to the PO line form when creating an order from the instance --- CHANGELOG.md | 1 + .../NewOrderModal/NewOrderModalContainer.js | 13 ++++++++++--- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0676ba8ec..5519d44b2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -101,6 +101,7 @@ * Consortial Central Tenant: Handling Holdings and Item actions on the Instance detail view. Refs UIIN-2523. * Hide Held by facet in Inventory contributor and subject browse. Refs UIIN-2591. * Use `==` for exact phrase search in Advanced Search for all full-text and term fields. Refs UIIN-2612. +* Provide an instance `tenantId` to the PO line form when creating an order from the instance. Refs UIIN-2614. ## [9.4.12](https://github.com/folio-org/ui-inventory/tree/v9.4.12) (2023-09-21) [Full Changelog](https://github.com/folio-org/ui-inventory/compare/v9.4.11...v9.4.12) diff --git a/src/components/NewOrderModal/NewOrderModalContainer.js b/src/components/NewOrderModal/NewOrderModalContainer.js index 2266554a3..39be2b987 100644 --- a/src/components/NewOrderModal/NewOrderModalContainer.js +++ b/src/components/NewOrderModal/NewOrderModalContainer.js @@ -9,8 +9,12 @@ import { useParams, } from 'react-router-dom'; -import { useOkapiKy } from '@folio/stripes/core'; +import { + useOkapiKy, + useStripes, +} from '@folio/stripes/core'; +import { useInstance } from '../../common'; import { ORDERS_API } from '../../constants'; import NewOrderModal from './NewOrderModal'; @@ -20,7 +24,9 @@ const NewOrderModalContainer = ({ }) => { const history = useHistory(); const ky = useOkapiKy(); + const stripes = useStripes(); const { id } = useParams(); + const { instance } = useInstance(id); const [orderId, setOrderId] = useState(); const validatePONumber = useCallback(async (poNumber) => { @@ -45,9 +51,10 @@ const NewOrderModalContainer = ({ const onSubmit = useCallback(() => { const route = orderId ? `/orders/view/${orderId}/po-line/create` : '/orders/create'; + const instanceTenantId = instance?.tenantId || stripes.okapi.tenant; - history.push(route, { instanceId: id }); - }, [orderId]); + history.push(route, { instanceId: id, instanceTenantId }); + }, [instance, orderId, stripes.okapi.tenant]); return (