Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert "UIQM-530 Create/Edit/Derive MARC bib/holdings/authority - Allow a user to move 00X fields (#594)" #597

Merged
merged 2 commits into from
Sep 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down
12 changes: 6 additions & 6 deletions src/QuickMarcEditor/QuickMarcEditorRows/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 4 additions & 2 deletions src/QuickMarcEditor/QuickMarcEditorRows/utils.test.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import {
LEADER_TAG,
QUICK_MARC_ACTIONS,
} from '../constants';
import { MARC_TYPES } from '../../common/constants';

Expand Down Expand Up @@ -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', () => {
Expand Down