From f75fc55744015fc14ae149b93096bf5facffc904 Mon Sep 17 00:00:00 2001 From: Alisher Musurmonov Date: Wed, 27 Nov 2024 14:24:55 +0500 Subject: [PATCH] UIOR-1348: Add "Donor (Deprecated)" label for PO line search by Donor filed --- CHANGELOG.md | 2 ++ src/common/utils/getAcqUnitsByIds.js | 13 ------------- src/common/utils/getVersionMetadata.js | 7 ------- src/common/utils/index.js | 2 -- .../useSelectedPOLineVersion.js | 6 ++++-- .../useSelectedPOVersion/useSelectedPOVersion.js | 6 +++--- src/components/PurchaseOrder/util.js | 3 +++ translations/ui-orders/en.json | 2 +- 8 files changed, 13 insertions(+), 28 deletions(-) delete mode 100644 src/common/utils/getAcqUnitsByIds.js delete mode 100644 src/common/utils/getVersionMetadata.js diff --git a/CHANGELOG.md b/CHANGELOG.md index 41e48b753..6a32df124 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ ## 7.1.0 (IN PROGRESS) +* Add "Donor (Deprecated)" label for PO line search by Donor filed. Refs UIOR-1348. + ## [7.0.1](https://github.com/folio-org/ui-orders/tree/v7.0.1) (2024-11-14) [Full Changelog](https://github.com/folio-org/ui-orders/compare/v7.0.0...v7.0.1) diff --git a/src/common/utils/getAcqUnitsByIds.js b/src/common/utils/getAcqUnitsByIds.js deleted file mode 100644 index 64272e761..000000000 --- a/src/common/utils/getAcqUnitsByIds.js +++ /dev/null @@ -1,13 +0,0 @@ -import { - ACQUISITIONS_UNITS_API, - fetchExportDataByIds, -} from '@folio/stripes-acq-components'; - -export const getAcqUnitsByIds = (ky) => async (acquisitionUnitIds) => { - return fetchExportDataByIds({ - api: ACQUISITIONS_UNITS_API, - ids: acquisitionUnitIds, - ky, - records: 'acquisitionsUnits', - }); -}; diff --git a/src/common/utils/getVersionMetadata.js b/src/common/utils/getVersionMetadata.js deleted file mode 100644 index 889945e81..000000000 --- a/src/common/utils/getVersionMetadata.js +++ /dev/null @@ -1,7 +0,0 @@ -import { get } from 'lodash'; - -export const getVersionMetadata = (version, entity) => ({ - ...get(entity, 'metadata', {}), - updatedByUserId: version?.userId, - updatedDate: version?.actionDate, -}); diff --git a/src/common/utils/index.js b/src/common/utils/index.js index 011987ade..0aa96ba34 100644 --- a/src/common/utils/index.js +++ b/src/common/utils/index.js @@ -3,7 +3,6 @@ export * from './checkPOLinesAbandonedHoldings'; export * from './checkRelatedHoldings'; export * from './createClearFilterHandler'; export * from './fieldArray'; -export * from './getAcqUnitsByIds'; export * from './getFundOptions'; export * from './getSettingsList'; export * from './getAddresses'; @@ -16,7 +15,6 @@ export * from './getLocations'; export * from './getPOLinePieces'; export * from './getMaterialTypes'; export * from './getUserNameById'; -export * from './getVersionMetadata'; export * from './getExportAccountNumbers'; export * from './getRecordMap'; export * from './getTenantAddresses'; diff --git a/src/components/POLine/hooks/useSelectedPOLineVersion/useSelectedPOLineVersion.js b/src/components/POLine/hooks/useSelectedPOLineVersion/useSelectedPOLineVersion.js index 928464558..2a045cc51 100644 --- a/src/components/POLine/hooks/useSelectedPOLineVersion/useSelectedPOLineVersion.js +++ b/src/components/POLine/hooks/useSelectedPOLineVersion/useSelectedPOLineVersion.js @@ -13,12 +13,14 @@ import { useNamespace, useOkapiKy, } from '@folio/stripes/core'; -import { useLocationsQuery } from '@folio/stripes-acq-components'; +import { + useLocationsQuery, + getVersionMetadata, +} from '@folio/stripes-acq-components'; import { getMaterialTypes, getOrganizationsByIds, - getVersionMetadata, } from '../../../../common/utils'; import { useAcqMethods, diff --git a/src/components/PurchaseOrder/hooks/useSelectedPOVersion/useSelectedPOVersion.js b/src/components/PurchaseOrder/hooks/useSelectedPOVersion/useSelectedPOVersion.js index ddb787edf..dda03fe73 100644 --- a/src/components/PurchaseOrder/hooks/useSelectedPOVersion/useSelectedPOVersion.js +++ b/src/components/PurchaseOrder/hooks/useSelectedPOVersion/useSelectedPOVersion.js @@ -15,16 +15,16 @@ import { } from '@folio/stripes/core'; import { getFullName } from '@folio/stripes/util'; import { + fetchAcqUnitsByIds, getAddresses, + getVersionMetadata, useUsersBatch, } from '@folio/stripes-acq-components'; import { useOrder } from '../../../../common/hooks'; import { - getAcqUnitsByIds, getOrganizationsByIds, getTenantAddresses, - getVersionMetadata, } from '../../../../common/utils'; const getUniqItems = (arr) => ( @@ -81,7 +81,7 @@ export const useSelectedPOVersion = ({ versionId, versions, snapshotPath }, opti addressesMap, ] = await Promise.all([ getOrganizationsByIds(ky)(organizationIds).then(keyBy('id')), - getAcqUnitsByIds(ky)(acqUnitsIds).then(keyBy('id')), + fetchAcqUnitsByIds(ky)(acqUnitsIds).then(keyBy('id')), getTenantAddresses(ky)() .then(({ configs }) => getAddresses(configs)) .then(keyBy('id')), diff --git a/src/components/PurchaseOrder/util.js b/src/components/PurchaseOrder/util.js index 405ed3a80..ccbeb7b36 100644 --- a/src/components/PurchaseOrder/util.js +++ b/src/components/PurchaseOrder/util.js @@ -120,5 +120,8 @@ export const getPoFieldsLabelMap = () => { 'closeReason': 'ui-orders.orderSummary.closingReason', 'closeReason.reason': 'ui-orders.orderSummary.closingReason', 'closeReason.note': 'ui-orders.orderSummary.closingNote', + + // Custom fields + 'customFields.externalOrderNumber': 'ui-orders.orderDetails.externalOrderNumber', }; }; diff --git a/translations/ui-orders/en.json b/translations/ui-orders/en.json index 9ab469423..3bc900440 100644 --- a/translations/ui-orders/en.json +++ b/translations/ui-orders/en.json @@ -681,8 +681,8 @@ "search.contributors": "Contributor", "search.dateOpened": "Date opened", "search.details.productIds": "Product ID", - "search.donor": "Donor", "search.keyword": "Keyword", + "search.donor": "Donor (Deprecated)", "search.metadata.createdDate": "Date created", "search.physical.volumes": "Volumes", "search.poLineNumber": "PO line number",