Skip to content

Commit

Permalink
Merge branch 'master' into UIQM-381
Browse files Browse the repository at this point in the history
  • Loading branch information
BogdanDenis authored Dec 11, 2023
2 parents 9a4ea5b + 2facb13 commit 53ca851
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 7 deletions.
7 changes: 5 additions & 2 deletions src/QuickMarcEditor/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -659,8 +659,11 @@ export const isFieldLinked = (field) => Boolean(field.linkDetails?.linkingRuleId
export const recordHasLinks = (fields) => fields.some(isFieldLinked);

export const validateSubfield = (marcRecords) => {
const marcRecordsWithSubfields = marcRecords.filter(marcRecord => marcRecord.indicators);
const isEmptySubfield = marcRecordsWithSubfields.some(marcRecord => {
const recordsToValidate = marcRecords
.filter(marcRecord => Boolean(marcRecord.tag))
.filter(marcRecord => marcRecord.indicators);

const isEmptySubfield = recordsToValidate.some(marcRecord => {
return !marcRecord.content && checkIsInitialRecord(marcRecord);
});

Expand Down
19 changes: 19 additions & 0 deletions src/QuickMarcEditor/utils.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -1467,13 +1467,32 @@ describe('QuickMarcEditor utils', () => {
expect(utils.validateSubfield(records)).not.toBeDefined();
});

it('should not return error message when tag is present and content is empty', () => {
const records = [
{
tag: '100',
content: '',
id: 'id1',
},
{
indicators: ['\\', '7'],
content: 'test',
id: 'id2',
},
];

expect(utils.validateSubfield(records)).not.toBeDefined();
});

it('should return error message when content is empty', () => {
const records = [
{
tag: '100',
indicators: ['\\', '\\'],
id: 'id1',
},
{
tag: '100',
indicators: [undefined, undefined],
id: 'id2',
},
Expand Down
10 changes: 5 additions & 5 deletions translations/ui-quick-marc/pt_BR.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
"record.fixedField.FMus": "FMus",
"record.fixedField.LTxt": "LTxt",
"record.fixedField.DtSt": "DtSt",
"record.fixedField.Date1": "Data de início",
"record.fixedField.Date2": "Data de término",
"record.fixedField.Date1": "Data 1",
"record.fixedField.Date2": "Data 2",
"record.fixedField.Ills": "Ills",
"record.fixedField.Cont": "Cont",
"record.fixedField.Conf": "Conf",
Expand Down Expand Up @@ -275,8 +275,8 @@
"records.autoLink.notLinkedFields.multiple": "Campo <b> {fieldTags} </b> {count, plural, one {} =2 { e <b> {lastFieldTag} </b> } other { , e <b> {lastFieldTag} </b> }} deve ser definido manualmente selecionando o ícone de link. Existem vários registros de autoridade que podem corresponder a este campo bibliográfico.",
"record.fixedField.tip.Date entered on file": "Data inserida no arquivo",
"record.fixedField.tip.Type of date/Publication status": "Tipo de data/status de publicação",
"record.fixedField.tip.Start date": "Data de início",
"record.fixedField.tip.End date": "Data final",
"record.fixedField.tip.Start date": "Data 1",
"record.fixedField.tip.End date": "Data 2",
"record.fixedField.tip.Place of publication, production, or execution": "Local de publicação, produção ou execução",
"record.fixedField.tip.Illustrations": "Ilustrações",
"record.fixedField.tip.Target audience": "Público-alvo",
Expand Down Expand Up @@ -399,5 +399,5 @@
"sourceFileLookupModal": "Selecione o arquivo de autoridade",
"sourceFileLookupModal.fieldLabel": "Nome do arquivo de autoridade",
"sourceFileLookupModal.placeholder": "Selecione o arquivo de autoridade",
"authority-record.create.title": "Create a new {shared, select, true {shared} false {local} other {}} MARC Authority record"
"authority-record.create.title": "Criar um novo registro de autoridade MARC {shared, select, true {compartilhado} false {local} other {}}"
}

0 comments on commit 53ca851

Please sign in to comment.