From: Jason Etheridge Date: Wed, 19 Oct 2022 11:00:13 +0000 (-0400) Subject: layout tweaks and propagate metabib attributes for Formats and Editions X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=6fbb032b72d0ebad5cac40cb856aa2d708917b63;p=working%2FEvergreen.git layout tweaks and propagate metabib attributes for Formats and Editions --- diff --git a/Open-ILS/src/eg2/src/app/share/catalog/bib-record.service.ts b/Open-ILS/src/eg2/src/app/share/catalog/bib-record.service.ts index a4dd0b0f2e..0bc02cd0c2 100644 --- a/Open-ILS/src/eg2/src/app/share/catalog/bib-record.service.ts +++ b/Open-ILS/src/eg2/src/app/share/catalog/bib-record.service.ts @@ -37,6 +37,7 @@ 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 orgId: number; orgDepth: number; record: IdlObject; @@ -128,6 +129,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.display = bibSummary.display; summary.attributes = bibSummary.attributes; summary.holdCount = bibSummary.hold_count; diff --git a/Open-ILS/src/eg2/src/app/staff/share/bib-staff-view/bib-staff-view.component.html b/Open-ILS/src/eg2/src/app/staff/share/bib-staff-view/bib-staff-view.component.html index 130c173076..471c35970b 100644 --- a/Open-ILS/src/eg2/src/app/staff/share/bib-staff-view/bib-staff-view.component.html +++ b/Open-ILS/src/eg2/src/app/staff/share/bib-staff-view/bib-staff-view.component.html @@ -1,522 +1,537 @@
-
-
-
- -
-
-
+
+
-
-
-
- -
-
-
+
+
+
+ +
+
+
-
-
-
-
    -
  • -
    -
    Edition:
    -
    - {{summary.display.edition}} -
    -
    -
    -
  • -
-
-
-
+ +
+
+
+ +
+
+
+
-
-
-
-
    -
  • -
    -
    Publisher:
    -
    - {{summary.display.publisher}} -
    -
    -
    -
  • -
-
-
-
+
+
+
+
    +
  • +
    +
    Edition:
    +
    + {{summary.display.edition}} +
    +
    +
  • +
+
+
+
-
-
-
- -
-
-
+
+
+
+
    +
  • +
    +
    Publisher:
    +
    + {{summary.display.publisher}} +
    +
    +
  • +
+
+
+
-
-
-
- -
-
-
+
+
+
+ +
+
+
-
-
-
- -
-
-
+ +
+
+
+ +
+
+
+
-
-
-
- -
-
-
+ +
+
+
+ +
+
+
+
-
-
-
- -
-
-
+ +
+
+
+ +
+
+
+
-
-
-
- -
-
-
+ +
+
+
+ +
+
+
+
-
-
-
- -
-
-
+ +
+
+
+ +
+
+
+
-
-
-
-
    -
  • -
    -
    Type of Resource:
    -
    - {{summary.display.type_of_resource}} -
    -
    -
    -
  • -
-
-
-
+ +
+
+
+ +
+
+
+
-
-
-
-
    -
  • -
    -
    Physical Description:
    -
    - {{_desc}} -
    -
    -
    -
  • -
-
-
-
+ +
+
+
+
    +
  • +
    +
    Type of Resource:
    +
    + {{summary.display.type_of_resource}} +
    +
    +
  • +
+
+
+
+
-
-
-
- -
-
-
+ +
+
+
+
    +
  • +
    +
    Physical Description:
    +
    + {{_desc}} +
    +
    +
  • +
+
+
+
+
-
-
-
- -
-
-
+ +
+
+
+ +
+
+
+
-
-
-
- -
-
-
+ +
+
+
+ +
+
+
+
-
-
-
- -
-
-
+ +
+
+
+ +
+
+
+
-
-
-
- -
-
-
+ +
+
+
+ +
+
+
+
-
-
-
-
    -
  • -
    -
    Genre:
    -
    - {{_genre}} -
    -
    -
    -
  • -
-
-
-
+ +
+
+
+ +
+
+
+
-
-
-
-
    -
  • -
    -
    Bibliography:
    -
    - {{_bibliography}} -
    -
    -
    -
  • -
-
-
-
+ +
+
+
+
    +
  • +
    +
    Genre:
    +
    + {{_genre}} +
    +
    +
  • +
+
+
+
+
-
-
-
-
    -
  • -
    -
    Abstract:
    -
    - {{summary.display.abstract}} -
    -
    -
    -
  • -
-
-
-
+ +
+
+
+
    +
  • +
    +
    Bibliography:
    +
    + {{_bibliography}} +
    +
    +
  • +
+
+
+
+
-
-
-
-
    -
  • -
    -
    Table of Contents:
    -
    - {{summary.display.toc}} -
    -
    -
    -
  • -
-
-
-
+
+
+
+
    +
  • +
    +
    Abstract:
    +
    + {{summary.display.abstract}} +
    +
    +
  • +
+
+
+
-
-
-
-
    -
  • -
    -
    Thesis:
    -
    - {{_thesis}} -
    -
    -
    -
  • -
-
-
-
+
+
+
+
    +
  • +
    +
    Table of Contents:
    +
    + {{summary.display.toc}} +
    +
    +
  • +
+
+
+
-
-
-
-
    -
  • -
    -
    General Note:
    -
    - {{_note}} -
    -
    -
    -
  • -
-
-
-
+ +
+
+
+
    +
  • +
    +
    Thesis:
    +
    + {{_thesis}} +
    +
    +
  • +
+
+
+
+
-
-
-
-
    -
  • -
    -
    Hold count:
    -
    - {{summary.holdCount}} -
    -
    -
    -
  • -
-
-
-
+ +
+
+
+
    +
  • +
    +
    General Note:
    +
    + {{_note}} +
    +
    +
  • +
+
+
+
+
-
-
-
-
    -
  • -
    -
    Has holdable copy:
    -
    - Yes - No -
    -
    -
    -
  • -
-
-
-
+
+
-
-
-
-
    -
  • -
    -
    Copy Counts:
    -
    -
      -
    • - {{_count.available}} of {{_count.count}} copies available at {{orgName(_count.org_unit)}}. -
    • -
    -
    -
    -
    -
  • -
-
-
-
+
+
+
+
    +
  • +
    +
    Hold and Copy Counts:
    +
    +
      +
    • {{summary.holdCount}} hold requests
    • +
    • + Record is holdable. + Record is not holdable. +
    • +
    • + {{_count.available}} of {{_count.count}} copies available at {{orgName(_count.org_unit)}}. +
    • +
    +
    +
    +
  • +
+
+
+
+
+
+
+
    +
  • +
    +
    Formats and Editions:
    +
    +
      + +
    • + {{_x.key}} ({{_x.value}}) +
    • +
      + +
    • + {{_x.key}} ({{_x.value}}) +
    • +
      +
    +
    +
    +
  • +
+
+
+
+ +
+
diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Search/Biblio.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Search/Biblio.pm index 3af4a33d90..593920b530 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Search/Biblio.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Search/Biblio.pm @@ -3110,6 +3110,52 @@ sub catalog_record_summary { get_one_metarecord_summary($self, $e, $org_id, $rec_id) : get_one_record_summary($self, $e, $org_id, $rec_id); + # 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}}); + my @metabib_records = map { $_->source } @$maps; + $response->{metabib_records} = \@metabib_records; + + my $attributes = $U->get_bre_attrs(\@metabib_records); + # we get "243":{ + # "srce":{ + # "code":" ", + # "label":"National bibliographic agency" + # }, ...} + my $metabib_attr = {}; + + foreach my $bib_id ( keys %{ $attributes } ) { + foreach my $ctype ( keys %{ $attributes->{$bib_id} } ) { + # we want { + # "srce":{ + # "code": { " ":1, ... } # leaf value is the bib count + # "label": { "National bibliographic agency":1, ... } + # }, ...} + $metabib_attr->{$ctype} = {} unless $metabib_attr->{$ctype}; + $metabib_attr->{$ctype}->{code} = {} unless $metabib_attr->{$ctype}->{code}; + $metabib_attr->{$ctype}->{label} = {} unless $metabib_attr->{$ctype}->{label}; + if ( $metabib_attr->{$ctype}->{code}->{ $attributes->{$bib_id}->{$ctype}->{code} } ) { + $metabib_attr->{$ctype}->{code}->{ $attributes->{$bib_id}->{$ctype}->{code} } += 1; + } else { + $metabib_attr->{$ctype}->{code}->{ $attributes->{$bib_id}->{$ctype}->{code} } = 1; + } + if ( $metabib_attr->{$ctype}->{label}->{ $attributes->{$bib_id}->{$ctype}->{label} } ) { + $metabib_attr->{$ctype}->{label}->{ $attributes->{$bib_id}->{$ctype}->{label} } += 1; + } else { + $metabib_attr->{$ctype}->{label}->{ $attributes->{$bib_id}->{$ctype}->{label} } = 1; + } + } + } + $response->{metabib_attributes} = $metabib_attr; + } + } + ($response->{copy_counts}) = $copy_method->run($org_id, $rec_id); $response->{first_call_number} = get_first_call_number(