LP1910808 Staff catalog show call number
authorBill Erickson <berickxx@gmail.com>
Mon, 5 Jul 2021 20:04:56 +0000 (16:04 -0400)
committerBill Erickson <berickxx@gmail.com>
Tue, 13 Jul 2021 16:02:07 +0000 (12:02 -0400)
In the search results page, show the first call number for each record
(sorting by label sortkey) that is owned either by the user's preferred
library or the search library.

Signed-off-by: Bill Erickson <berickxx@gmail.com>
Signed-off-by: Galen Charlton <gmc@equinoxOLI.org>

Open-ILS/src/eg2/src/app/share/catalog/bib-record.service.ts
Open-ILS/src/eg2/src/app/share/catalog/catalog.service.ts
Open-ILS/src/eg2/src/app/staff/catalog/result/record.component.html
Open-ILS/src/perlmods/lib/OpenILS/Application/Search/Biblio.pm

index 999ce37..f7e54d3 100644 (file)
@@ -35,6 +35,7 @@ export class BibRecordSummary {
     holdingsSummary: any;
     holdCount: number;
     bibCallNumber: string;
+    firstCallNumber: string;
     net: NetService;
     displayHighlights: {[name: string]: string | string[]} = {};
     eResourceUrls: EResourceUrl[] = [];
@@ -115,6 +116,7 @@ export class BibRecordService {
             summary.holdingsSummary = bibSummary.copy_counts;
             summary.eResourceUrls = bibSummary.urls;
             summary.copies = bibSummary.copies;
+            summary.firstCallNumber = bibSummary.first_call_number;
 
             return summary;
         }));
@@ -140,6 +142,7 @@ export class BibRecordService {
             summary.holdCount = metabibSummary.hold_count;
             summary.holdingsSummary = metabibSummary.copy_counts;
             summary.copies = metabibSummary.copies;
+            summary.firstCallNumber = metabibSummary.first_call_number;
 
             return summary;
         }));
index d2e3044..798f549 100644 (file)
@@ -212,7 +212,8 @@ export class CatalogService {
 
         let observable: Observable<BibRecordSummary>;
 
-        const options: any = {};
+        const options: any = {pref_ou: ctx.prefOu};
+
         if (ctx.showResultExtras) {
             options.flesh_copies = true;
             options.copy_depth = depth;
index a48f33c..4bd0fe1 100644 (file)
           </div>
           <div class="row pt-2">
             <div class="col-lg-12">
+              <ng-container *ngIf="summary.firstCallNumber">
+                <div class="pb-1" i18n>Call Number:
+                  {{summary.firstCallNumber.call_number_prefix_label}}
+                  {{summary.firstCallNumber.call_number_label}}
+                  {{summary.firstCallNumber.call_number_suffix_label}}
+                </div>
+              </ng-container>
               <ng-container *ngIf="summary.display.physical_description">
                 <!-- [].concat() to avoid modifying the summary arrays -->
                 <div class="pb-1" i18n>Phys. Desc.:
index 1bdb62f..384677e 100644 (file)
@@ -3095,6 +3095,9 @@ sub catalog_record_summary {
 
         ($response->{copy_counts}) = $copy_method->run($org_id, $rec_id);
 
+        $response->{first_call_number} = get_first_call_number(
+            $e, $rec_id, $org_id, $is_staff, $is_meta, $options);
+
         $response->{hold_count} = 
             $U->simplereq('open-ils.circ', $holds_method, $rec_id);
 
@@ -3175,6 +3178,20 @@ sub get_representative_copies {
     return $copies;
 }
 
+sub get_first_call_number {
+    my ($e, $rec_id, $org_id, $is_staff, $is_meta, $options) = @_;
+
+    my $limit = $options->{copy_limit};
+    $options->{copy_limit} = 1;
+
+    my $copies = get_representative_copies(
+        $e, $rec_id, $org_id, $is_staff, $is_meta, $options);
+
+    $options->{copy_limit} = $limit;
+
+    return $copies->[0];
+}
+
 sub get_one_rec_urls {
     my ($self, $e, $org_id, $bib_id) = @_;