diff --git a/CHANGELOG.md b/CHANGELOG.md index d982e194..835eb5fc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -54,7 +54,6 @@ * [UIQM-554](https://issues.folio.org/browse/UIQM-554) Don't pass any arguments to the onClose callback when clicking the Cancel panel button. * [UIQM-556](https://issues.folio.org/browse/UIQM-556) Edit Shared MARC authority record, update Shared & Local Instances. * [UIQM-558](https://issues.folio.org/browse/UIQM-558) *BREAKING* bump `react-intl` to `v6.4.4`. -* [UIQM-530](https://issues.folio.org/browse/UIQM-530) Create/Edit/Derive MARC bib/holdings/authority - Allow a user to move 00X fields. * [UIQM-559](https://issues.folio.org/browse/UIQM-559) Make auto-linking for the consortium. * [UIQM-558](https://issues.folio.org/browse/UIQM-558) Allow a user to select a location code from the plugin. diff --git a/src/QuickMarcEditor/QuickMarcEditorRows/utils.js b/src/QuickMarcEditor/QuickMarcEditorRows/utils.js index cdd743f8..552ec4e1 100644 --- a/src/QuickMarcEditor/QuickMarcEditorRows/utils.js +++ b/src/QuickMarcEditor/QuickMarcEditorRows/utils.js @@ -18,14 +18,14 @@ export const hasAddException = (recordRow, marcType = MARC_TYPES.BIB) => { return ADD_EXCEPTION_ROWS[marcType].has(recordRow.tag); }; -const MOVE_EXCEPTION_ROWS = { - [QUICK_MARC_ACTIONS.CREATE]: new Set([LEADER_TAG]), - [QUICK_MARC_ACTIONS.EDIT]: new Set([LEADER_TAG]), - [QUICK_MARC_ACTIONS.DERIVE]: new Set([LEADER_TAG]), -}; +const MOVE_EXCEPTION_ROWS = new Set([LEADER_TAG, '001', '005', '008']); + +const MOVE_EXCEPTION_ROWS_FOR_DERIVE = new Set([LEADER_TAG, '001', '003', '005', '008']); export const hasMoveException = (recordRow, sibling, action = QUICK_MARC_ACTIONS.EDIT) => { - const rows = MOVE_EXCEPTION_ROWS[action]; + const rows = action === QUICK_MARC_ACTIONS.DERIVE + ? MOVE_EXCEPTION_ROWS_FOR_DERIVE + : MOVE_EXCEPTION_ROWS; return ( !sibling diff --git a/src/QuickMarcEditor/QuickMarcEditorRows/utils.test.js b/src/QuickMarcEditor/QuickMarcEditorRows/utils.test.js index 4e34ac88..964eab6a 100644 --- a/src/QuickMarcEditor/QuickMarcEditorRows/utils.test.js +++ b/src/QuickMarcEditor/QuickMarcEditorRows/utils.test.js @@ -1,5 +1,6 @@ import { LEADER_TAG, + QUICK_MARC_ACTIONS, } from '../constants'; import { MARC_TYPES } from '../../common/constants'; @@ -36,10 +37,11 @@ describe('QuickMarcEditorRows utils', () => { describe('hasMoveException', () => { it('should be true for exeptional row', () => { expect(utils.hasMoveException({ tag: LEADER_TAG })).toBeTruthy(); + expect(utils.hasMoveException({ tag: '001' })).toBeTruthy(); }); - it('should be false for 0XX fields', () => { - expect(utils.hasMoveException({ tag: '001' }, { tag: '005' })).toBeFalsy(); + it('should be true for 003 tag for derive action', () => { + expect(utils.hasMoveException({ tag: '003' }, { tag: '014' }, QUICK_MARC_ACTIONS.DERIVE)).toBeTruthy(); }); it('should be false for common rows', () => {