diff --git a/CHANGELOG.md b/CHANGELOG.md index 78daf4fc..96b1d774 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,7 @@ * [UIBULKED-571](https://folio-org.atlassian.net/browse/UIBULKED-571) Errors in response to UI calls. * [UIBULKED-568](https://folio-org.atlassian.net/browse/UIBULKED-568) Populating Are you sure? form * [UIBULKED-543](https://folio-org.atlassian.net/browse/UIBULKED-543) Rename Find (full field search) to Find. +* [UIBULKED-599](https://folio-org.atlassian.net/browse/UIBULKED-599) Change Administrative note type is not supported for MARC instances. ## [4.2.2](https://github.com/folio-org/ui-bulk-edit/tree/v4.2.2) (2024-11-15) diff --git a/src/components/BulkEditPane/BulkEditListResult/BulkEditInApp/ContentUpdatesForm/ContentUpdatesForm.js b/src/components/BulkEditPane/BulkEditListResult/BulkEditInApp/ContentUpdatesForm/ContentUpdatesForm.js index 5dd9e67e..4c6d4235 100644 --- a/src/components/BulkEditPane/BulkEditListResult/BulkEditInApp/ContentUpdatesForm/ContentUpdatesForm.js +++ b/src/components/BulkEditPane/BulkEditListResult/BulkEditInApp/ContentUpdatesForm/ContentUpdatesForm.js @@ -34,10 +34,10 @@ import css from '../../../BulkEditPane.css'; export const ContentUpdatesForm = ({ fields, setFields, options }) => { const { formatMessage } = useIntl(); - const { currentRecordType } = useSearchParams(); + const { currentRecordType, approach } = useSearchParams(); useEffect(() => { - setFields([getFieldTemplate(options, currentRecordType)]); + setFields([getFieldTemplate(options, currentRecordType, approach)]); // eslint-disable-next-line }, []); @@ -56,6 +56,7 @@ export const ContentUpdatesForm = ({ fields, setFields, options }) => { capability: currentRecordType, option, options, + approach, }), }; } @@ -171,7 +172,7 @@ export const ContentUpdatesForm = ({ fields, setFields, options }) => { const handleAdd = () => { const filteredFields = getFilteredFields([...fields, { - ...getFieldTemplate(options, currentRecordType), + ...getFieldTemplate(options, currentRecordType, approach), id: uniqueId(), actionsDetails: { type: null, @@ -191,6 +192,7 @@ export const ContentUpdatesForm = ({ fields, setFields, options }) => { capability: currentRecordType, option, options, + approach, }), }) : f; diff --git a/src/components/BulkEditPane/BulkEditListResult/BulkEditInApp/ContentUpdatesForm/helpers.js b/src/components/BulkEditPane/BulkEditListResult/BulkEditInApp/ContentUpdatesForm/helpers.js index c6fa9c5a..cfaa0bf0 100644 --- a/src/components/BulkEditPane/BulkEditListResult/BulkEditInApp/ContentUpdatesForm/helpers.js +++ b/src/components/BulkEditPane/BulkEditListResult/BulkEditInApp/ContentUpdatesForm/helpers.js @@ -3,6 +3,7 @@ import uniqueId from 'lodash/uniqueId'; import { CONTROL_TYPES, OPTIONS, + APPROACHES, BASE_DATE_FORMAT, FINAL_ACTIONS, ACTIONS, @@ -22,6 +23,7 @@ import { noteActionsWithDuplicate, electronicAccess, statisticalCodeActions, + noteActionsMarc, electronicAccessWithFindFullField, } from '../../../../../constants'; import { getActionParameters } from '../../../../../constants/actionParameters'; @@ -83,6 +85,7 @@ export const getDefaultActions = ({ option, options, capability, + approach, }) => { const replaceClearDefaultActions = replaceClearActions(); const emailDefaultFindActions = emailActionsFind(); @@ -95,6 +98,7 @@ export const getDefaultActions = ({ const statusDefaultActions = statusActions(); const loanDefaultActions = permanentLoanTypeActions(); const noteDefaultActions = noteActions(); + const noteDefaultActionsMarc = noteActionsMarc(); const noteWithMarcDefaultActions = noteActionsWithMarc(); const noteDuplicateDefaultActions = noteActionsWithDuplicate(); const electronicAccessActions = electronicAccess(); @@ -274,7 +278,9 @@ export const getDefaultActions = ({ actions: [ null, { - actionsList: noteDefaultActions, + actionsList: approach === APPROACHES.MARC + ? noteDefaultActionsMarc + : noteDefaultActions, controlType: (action) => { return action === ACTIONS.CHANGE_TYPE ? CONTROL_TYPES.NOTE_SELECT @@ -500,7 +506,7 @@ export const getMappedContentUpdates = (fields, options) => fields.map(({ }; }); -export const getFieldTemplate = (options, capability) => { +export const getFieldTemplate = (options, capability, approach) => { return ({ id: uniqueId(), options, @@ -509,6 +515,7 @@ export const getFieldTemplate = (options, capability) => { actionsDetails: getDefaultActions({ option: '', capability, + approach, options, }), }); diff --git a/src/components/BulkEditPane/BulkEditListResult/BulkEditInApp/ContentUpdatesForm/helpers.test.js b/src/components/BulkEditPane/BulkEditListResult/BulkEditInApp/ContentUpdatesForm/helpers.test.js index 97d7e473..b8c6285a 100644 --- a/src/components/BulkEditPane/BulkEditListResult/BulkEditInApp/ContentUpdatesForm/helpers.test.js +++ b/src/components/BulkEditPane/BulkEditListResult/BulkEditInApp/ContentUpdatesForm/helpers.test.js @@ -5,6 +5,7 @@ import { OPTIONS, commonAdditionalActions, CAPABILITIES, + APPROACHES, PARAMETERS_KEYS, } from '../../../../../constants'; @@ -835,6 +836,51 @@ describe('ContentUpdatesForm helpers', () => { )); }); + it('returns the correct object for the ADMINISTRATIVE_NOTE option using instance marc', () => { + expect(JSON.stringify(getDefaultActions({ + option: OPTIONS.ADMINISTRATIVE_NOTE, + options: [], + formatMessage, + capability: CAPABILITIES.INSTANCE, + approach: APPROACHES.MARC + }))) + .toEqual( + JSON.stringify({ + type: '', + actions: [ + null, + { + actionsList: [ + { + value: '', + label: , + disabled: true, + }, + { + value: ACTIONS.ADD_TO_EXISTING, + label: , + disabled: false, + }, + { + value: ACTIONS.REMOVE_ALL, + label: , + disabled: false, + }, + { + value: ACTIONS.FIND, + label: , + disabled: false, + }, + ], + controlType: () => CONTROL_TYPES.TEXTAREA, + [ACTION_VALUE_KEY]: '', + [FIELD_VALUE_KEY]: '', + }, + ], + }) + ); + }); + it('returns the correct object for the ELECTRONIC_ACCESS_MATERIALS_SPECIFIED option', () => { expect(JSON.stringify(getDefaultActions({ option: OPTIONS.ELECTRONIC_ACCESS_MATERIALS_SPECIFIED, diff --git a/src/constants/inAppActions.js b/src/constants/inAppActions.js index f15a0ec1..f7c2b038 100644 --- a/src/constants/inAppActions.js +++ b/src/constants/inAppActions.js @@ -157,11 +157,15 @@ export const statisticalCodeActions = () => [ getRemoveAllAction(), ]; -export const noteActions = () => [ +export const noteActionsMarc = () => [ getPlaceholder(), getAddToExistingAction(), getRemoveAllAction(), getFindAction(), +]; + +export const noteActions = () => [ + ...noteActionsMarc(), getChangeNoteTypeAction(), ];