Skip to content

Commit

Permalink
UIQM-381 Remove default 100 field for Create authority, fix initial v…
Browse files Browse the repository at this point in the history
…alues for 008 (#632)
  • Loading branch information
BogdanDenis authored Dec 11, 2023
1 parent 2facb13 commit 00220d8
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 20 deletions.
2 changes: 1 addition & 1 deletion src/QuickMarcEditor/QuickMarcCreateWrapper.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ const QuickMarcCreateWrapper = ({
removeDeletedRecords,
removeFieldsForDerive,
autopopulateIndicators,
marcRecord => autopopulateFixedField(marcRecord, marcType),
marcRecord => autopopulateFixedField(marcRecord, marcType, fixedFieldSpec),
autopopulatePhysDescriptionField,
autopopulateMaterialCharsField,
marcRecord => autopopulateSubfieldSection(marcRecord, marcType),
Expand Down
2 changes: 1 addition & 1 deletion src/QuickMarcEditor/QuickMarcDeriveWrapper.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ const QuickMarcDeriveWrapper = ({
removeFieldsForDerive,
removeEnteredDate,
autopopulateIndicators,
marcRecord => autopopulateFixedField(marcRecord, marcType),
marcRecord => autopopulateFixedField(marcRecord, marcType, fixedFieldSpec),
autopopulatePhysDescriptionField,
autopopulateMaterialCharsField,
marcRecord => autopopulateSubfieldSection(marcRecord, marcType),
Expand Down
2 changes: 1 addition & 1 deletion src/QuickMarcEditor/QuickMarcEditWrapper.js
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ const QuickMarcEditWrapper = ({
const formValuesToProcess = flow(
prepareForSubmit,
autopopulateIndicators,
marcRecord => autopopulateFixedField(marcRecord, marcType),
marcRecord => autopopulateFixedField(marcRecord, marcType, fixedFieldSpec),
autopopulatePhysDescriptionField,
autopopulateMaterialCharsField,
marcRecord => autopopulateSubfieldSection(marcRecord, marcType),
Expand Down
2 changes: 1 addition & 1 deletion src/QuickMarcEditor/QuickMarcEditorContainer.js
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ const QuickMarcEditorContainer = ({
let dehydratedMarcRecord;

if (action === QUICK_MARC_ACTIONS.CREATE) {
dehydratedMarcRecord = createRecordDefaults[marcType](instanceResponse);
dehydratedMarcRecord = createRecordDefaults[marcType](instanceResponse, fixedFieldSpecResponse);
} else {
dehydratedMarcRecord = dehydrateMarcRecordResponse(marcRecordResponse, marcType, fixedFieldSpecResponse);
}
Expand Down
4 changes: 3 additions & 1 deletion src/QuickMarcEditor/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ export const CREATE_HOLDINGS_RECORD_DEFAULT_FIELD_TAGS = ['001', '004', '005', '

export const CREATE_BIB_RECORD_DEFAULT_FIELD_TAGS = ['001', '005', '008', '245', '999'];

export const CREATE_AUTHORITY_RECORD_DEFAULT_FIELD_TAGS = ['001', '005', '008', '100', '999'];
export const CREATE_AUTHORITY_RECORD_DEFAULT_FIELD_TAGS = ['001', '005', '008', '999'];

export const QM_RECORD_STATUS_TIMEOUT = 5000;

Expand Down Expand Up @@ -120,6 +120,8 @@ export const HOLDINGS_FIXED_FIELD_DEFAULT_VALUES = {
export const BIB_FIXED_FIELD_DEFAULT_TYPE = 'a';
export const BIB_FIXED_FIELD_DEFAULT_BLVL = 'm';

export const AUTHORITY_FIXED_FIELD_DEFAULT_TYPE = 'z';

export const CORRESPONDING_HEADING_TYPE_TAGS = ['100', '110', '111', '151', '130', '150', '155'];

export const AUTOLINKING_STATUSES = {
Expand Down
27 changes: 13 additions & 14 deletions src/QuickMarcEditor/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ import {
UNCONTROLLED_ALPHA,
UNCONTROLLED_NUMBER,
TAG_LENGTH,
AUTHORITY_FIXED_FIELD_DEFAULT_TYPE,
} from './constants';
import { RECORD_STATUS_NEW } from './QuickMarcRecordInfo/constants';
import { SUBFIELD_TYPES } from './QuickMarcEditorRows/BytesField';
Expand Down Expand Up @@ -253,10 +254,10 @@ const getCreateMarcRecordDefaultFields = (contentMap, indicatorMap, defaultTags)
});
};

const getCreateBibMarcRecordDefaultFields = (instanceRecord) => {
const getCreateBibMarcRecordDefaultFields = (instanceRecord, fixedFieldSpec) => {
const contentMap = {
'001': instanceRecord.hrid,
'008': fillEmptyFixedFieldValues(MARC_TYPES.BIB, BIB_FIXED_FIELD_DEFAULT_TYPE, BIB_FIXED_FIELD_DEFAULT_BLVL),
'008': fillEmptyFixedFieldValues(MARC_TYPES.BIB, fixedFieldSpec, BIB_FIXED_FIELD_DEFAULT_TYPE, BIB_FIXED_FIELD_DEFAULT_BLVL),
'245': '$a ',
'999': '',
};
Expand All @@ -283,16 +284,14 @@ const getCreateHoldingsMarcRecordDefaultFields = (instanceRecord) => {
return getCreateMarcRecordDefaultFields(contentMap, indicatorMap, CREATE_HOLDINGS_RECORD_DEFAULT_FIELD_TAGS);
};

const getCreateAuthorityMarcRecordDefaultFields = (instanceRecord) => {
const getCreateAuthorityMarcRecordDefaultFields = (instanceRecord, fixedFieldSpec) => {
const contentMap = {
'001': instanceRecord.hrid,
'008': fillEmptyFixedFieldValues(MARC_TYPES.AUTHORITY),
'100': '$a ',
'008': fillEmptyFixedFieldValues(MARC_TYPES.AUTHORITY, fixedFieldSpec, AUTHORITY_FIXED_FIELD_DEFAULT_TYPE),
'999': '',
};

const indicatorMap = {
'100': ['\\', '\\'],
'999': ['f', 'f'],
};

Expand All @@ -318,7 +317,7 @@ export const getCreateHoldingsMarcRecordResponse = (instanceResponse) => {
};
};

export const getCreateBibMarcRecordResponse = (instanceResponse) => {
export const getCreateBibMarcRecordResponse = (instanceResponse, fixedFieldSpec) => {
const instanceId = '00000000-0000-0000-0000-000000000000'; // For create we need to send any UUID

return {
Expand All @@ -331,13 +330,13 @@ export const getCreateBibMarcRecordResponse = (instanceResponse) => {
content: CREATE_BIB_RECORD_DEFAULT_LEADER_VALUE,
id: LEADER_TAG,
},
...getCreateBibMarcRecordDefaultFields(instanceResponse),
...getCreateBibMarcRecordDefaultFields(instanceResponse, fixedFieldSpec),
],
parsedRecordDtoId: instanceId,
};
};

export const getCreateAuthorityMarcRecordResponse = (instanceResponse) => {
export const getCreateAuthorityMarcRecordResponse = (instanceResponse, fixedFieldSpec) => {
const instanceId = '00000000-0000-0000-0000-000000000000'; // For create we need to send any UUID

return {
Expand All @@ -350,7 +349,7 @@ export const getCreateAuthorityMarcRecordResponse = (instanceResponse) => {
content: CREATE_AUTHORITY_RECORD_DEFAULT_LEADER_VALUE,
id: LEADER_TAG,
},
...getCreateAuthorityMarcRecordDefaultFields(instanceResponse),
...getCreateAuthorityMarcRecordDefaultFields(instanceResponse, fixedFieldSpec),
],
parsedRecordDtoId: instanceId,
};
Expand Down Expand Up @@ -1178,7 +1177,7 @@ export const autopopulatePhysDescriptionField = (formValues) => {
};
};

export const autopopulateFixedField = (formValues, marcType, marcSpec) => {
export const autopopulateFixedField = (formValues, marcType, fixedFieldSpec) => {
const { records } = formValues;

const leader = records.find(field => field.tag === LEADER_TAG);
Expand All @@ -1194,7 +1193,7 @@ export const autopopulateFixedField = (formValues, marcType, marcSpec) => {

return {
...field,
content: fillEmptyFixedFieldValues(marcType, marcSpec, type, blvl, field),
content: fillEmptyFixedFieldValues(marcType, fixedFieldSpec, type, blvl, field),
};
}),
};
Expand Down Expand Up @@ -1500,10 +1499,10 @@ const addLeaderFieldAndIdToRecords = (marcRecordResponse) => ({
],
});

export const dehydrateMarcRecordResponse = (marcRecordResponse, marcType, marcSpec) => (
export const dehydrateMarcRecordResponse = (marcRecordResponse, marcType, fixedFieldSpec) => (
flow(
addLeaderFieldAndIdToRecords,
marcRecord => autopopulateFixedField(marcRecord, marcType, marcSpec),
marcRecord => autopopulateFixedField(marcRecord, marcType, fixedFieldSpec),
autopopulatePhysDescriptionField,
autopopulateMaterialCharsField,
)(marcRecordResponse)
Expand Down
2 changes: 1 addition & 1 deletion translations/ui-quick-marc/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"bibliographic-record.edit.title": "Edit {shared, select, true {shared} false {local} other {}} MARC record - {title}",
"bibliographic-record.derive.title": "Derive a new {shared, select, true {shared} false {local} other {}} MARC bib record",
"authority-record.edit.title": "Edit {shared, select, true {shared} false {local} other {}} MARC authority record - {title}",
"authority-record.create.title": "Create a new {shared, select, true {shared} false {local} other {}} MARC Authority record",
"authority-record.create.title": "Create a new {shared, select, true {shared} false {local} other {}} MARC authority record",
"holdings-record.edit.title": "Edit MARC holdings - Location: {location} - [{callNumber}]",

"record.status": "Status:",
Expand Down

0 comments on commit 00220d8

Please sign in to comment.