From fa921ae9d3cc1e418e85de379274588afb393eea Mon Sep 17 00:00:00 2001 From: Bill Erickson Date: Tue, 31 Dec 2019 10:58:55 -0500 Subject: [PATCH] LP1852782 Main entry link sets subfield 0 In the MARC editor, when applying a main entry heading, set the subfield 0 of the modified bib field to link to the authority record in question. Signed-off-by: Bill Erickson Signed-off-by: Jane Sandberg --- .../authority-linking-dialog.component.html | 7 +++--- .../authority-linking-dialog.component.ts | 29 +++++++++++++++------- 2 files changed, 24 insertions(+), 12 deletions(-) diff --git a/Open-ILS/src/eg2/src/app/staff/share/marc-edit/authority-linking-dialog.component.html b/Open-ILS/src/eg2/src/app/staff/share/marc-edit/authority-linking-dialog.component.html index df251677b3..2c8c3fcc1d 100644 --- a/Open-ILS/src/eg2/src/app/staff/share/marc-edit/authority-linking-dialog.component.html +++ b/Open-ILS/src/eg2/src/app/staff/share/marc-edit/authority-linking-dialog.component.html @@ -12,10 +12,11 @@ - + + (click)="applyHeading(field, authId)" i18n>Apply See From: {{field.heading}} See Also: {{field.heading}} @@ -92,7 +93,7 @@
  • + *ngTemplateOutlet="headingField;context:{field:entry.main_heading, authId: entry.authority_id}">
    this.browseData.push(entry)); } - applyHeading(authField: MarcField) { + applyHeading(authField: MarcField, authId?: number) { this.net.request( 'open-ils.cat', 'open-ils.cat.authority.bib_field.overlay_authority', this.fieldHash(), this.fieldHash(authField), this.controlSet - ).subscribe(field => this.close(field)); + ).subscribe(field => { + if (authId) { + // If an authId is provided, it means we are using + // a main entry heading and we should set the bib + // field's subfield 0 to refer to the main entry record. + this.setSubfieldZero(authId, field); + } + this.close(field); + }); } isControlledBibSf(sf: string): boolean { @@ -148,17 +156,20 @@ export class AuthorityLinkingDialogComponent this.authMeta.sf_list().includes(sf) : false; } - setSubfieldZero(authId: number) { - const sfZero = this.bibField.subfields.filter(sf => sf[0] === '0')[0]; + setSubfieldZero(authId: number, bibField?: MarcField) { + + if (!bibField) { bibField = this.bibField; } + + const sfZero = bibField.subfields.filter(sf => sf[0] === '0')[0]; if (sfZero) { - this.context.deleteSubfield(this.bibField, sfZero); + this.context.deleteSubfield(bibField, sfZero); } - this.context.insertSubfield(this.bibField, - ['0', `(${this.cni})${authId}`, this.bibField.subfields.length]); + this.context.insertSubfield(bibField, + ['0', `(${this.cni})${authId}`, bibField.subfields.length]); // Reset the validation state. - this.bibField.authChecked = null; - this.bibField.authValid = null; + bibField.authChecked = null; + bibField.authValid = null; } createNewAuthority(editFirst?: boolean) { -- 2.11.0