don't cross the streams with metabib related
authorJason Etheridge <jason@EquinoxOLI.org>
Thu, 20 Oct 2022 20:41:27 +0000 (16:41 -0400)
committerJason Etheridge <jason@EquinoxOLI.org>
Wed, 4 Jan 2023 13:44:00 +0000 (08:44 -0500)
field names for the record and metabib variants of the catalog_summary call.  This would otherwise break some links in search results involving bibs with metarecords.

Signed-off-by: Jason Etheridge <jason@EquinoxOLI.org>
Open-ILS/src/eg2/src/app/share/catalog/bib-record.service.ts
Open-ILS/src/eg2/src/app/staff/share/bib-staff-view/bib-staff-view.component.html
Open-ILS/src/perlmods/lib/OpenILS/Application/Search/Biblio.pm

index 0bc02cd..954906c 100644 (file)
@@ -37,7 +37,9 @@ export class BibRecordSummary {
     id: number; // == record.id() for convenience
     metabibId: number; // If present, this is a metabib summary
     metabibRecords: number[]; // all constituent bib records
-    metabibAttributes: any; // combined attributes for metabib records; would be redundant with attributes if the BibRecordSummary is populated by a metarecord, and so is not populated in that case
+    staffViewMetabibId: number; // to supplement a record summary
+    staffViewMetabibRecords: number[]; // to supplement a record summary
+    staffViewMetabibAttributes: any; // to supplement a record summary
     orgId: number;
     orgDepth: number;
     record: IdlObject;
@@ -129,9 +131,9 @@ export class BibRecordService {
         .pipe(map(bibSummary => {
             const summary = new BibRecordSummary(bibSummary.record, orgId);
             summary.net = this.net; // inject
-            summary.metabibId = Number(bibSummary.metabib_id);
-            summary.metabibRecords = bibSummary.metabib_records;
-            summary.metabibAttributes = bibSummary.metabib_attributes;
+            summary.staffViewMetabibId = Number(bibSummary.staff_view_metabib_id);
+            summary.staffViewMetabibRecords = bibSummary.staff_view_metabib_records;
+            summary.staffViewMetabibAttributes = bibSummary.staff_view_metabib_attributes;
             summary.display = bibSummary.display;
             summary.attributes = bibSummary.attributes;
             summary.holdCount = bibSummary.hold_count;
index 471c359..9ea09d1 100644 (file)
                   <div class="col-lg-4 font-weight-bold" i18n>Formats and Editions:</div>
                   <div class="col-lg-8 pl-1">
                     <ul class="list-group">
-                        <ng-container *ngIf="summary.metabibAttributes.icon_format">
-                        <li class="list-group-item" *ngFor="let _x of summary.metabibAttributes.icon_format.label | keyvalue">
+                        <ng-container *ngIf="summary.staffViewMetabibAttributes.icon_format">
+                        <li class="list-group-item" *ngFor="let _x of summary.staffViewMetabibAttributes.icon_format.label | keyvalue">
                             <span>{{_x.key}} ({{_x.value}})</span>
                         </li>
                         </ng-container>
-                        <ng-container *ngIf="summary.metabibAttributes.item_lang">
-                        <li class="list-group-item" *ngFor="let _x of summary.metabibAttributes.item_lang.label | keyvalue">
+                        <ng-container *ngIf="summary.staffViewMetabibAttributes.item_lang">
+                        <li class="list-group-item" *ngFor="let _x of summary.staffViewMetabibAttributes.item_lang.label | keyvalue">
                             <span>{{_x.key}} ({{_x.value}})</span>
                         </li>
                         </ng-container>
index 593920b..e7ed7c9 100644 (file)
@@ -3047,8 +3047,15 @@ __PACKAGE__->register_method(
             desc => q/
                 Stream of record summary objects including id, record,
                 hold_count, copy_counts, display (metabib display
-                fields), attributes (metabib record attrs), plus
-                metabib_id and metabib_records for the metabib variant.
+                fields), and attributes (metabib record attrs).  The
+                metabib variant of the call gets metabib_id and
+                metabib_records, and the regular record version also
+                gets some metabib information, but returns them as
+                staff_view_metabib_id, staff_view_metabib_records, and
+                staff_view_metabib_attributes.  This is to mitigate the
+                need for code changes elsewhere where assumptions are
+                made when certain fields are returned.
+                
             /
         }
     }
@@ -3112,15 +3119,12 @@ sub catalog_record_summary {
 
         # Let's get Formats & Editions data FIXME: consider peer bibs?
         unless ($is_meta) {
-            # metabib variant of this call already handle $response->{metabib_id} and $response->{metabib_records},
-            # and $response->{metabib_attributes} would be redundant with $response->{attributes} in that case, so
-            # is not populated unless using the non-metarecord variants of the call
             my $meta_search = $e->search_metabib_metarecord_source_map({source => $rec_id});
             if ($meta_search) {
-                $response->{metabib_id} = $meta_search->[0]->metarecord;
-                my $maps = $e->search_metabib_metarecord_source_map({metarecord => $response->{metabib_id}});
+                $response->{staff_view_metabib_id} = $meta_search->[0]->metarecord;
+                my $maps = $e->search_metabib_metarecord_source_map({metarecord => $response->{staff_view_metabib_id}});
                 my @metabib_records = map { $_->source } @$maps;
-                $response->{metabib_records} = \@metabib_records;
+                $response->{staff_view_metabib_records} = \@metabib_records;
 
                 my $attributes = $U->get_bre_attrs(\@metabib_records);
                 # we get "243":{
@@ -3152,7 +3156,7 @@ sub catalog_record_summary {
                         }
                     }
                 }
-                $response->{metabib_attributes} = $metabib_attr;
+                $response->{staff_view_metabib_attributes} = $metabib_attr;
             }
         }