From 633656df58cafff386da4576459c47301507d8b5 Mon Sep 17 00:00:00 2001 From: Bill Erickson Date: Mon, 5 Jul 2021 16:04:56 -0400 Subject: [PATCH] LP1910808 Staff catalog show call number 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 Signed-off-by: Galen Charlton --- .../src/eg2/src/app/share/catalog/bib-record.service.ts | 3 +++ .../src/eg2/src/app/share/catalog/catalog.service.ts | 3 ++- .../src/app/staff/catalog/result/record.component.html | 7 +++++++ .../perlmods/lib/OpenILS/Application/Search/Biblio.pm | 17 +++++++++++++++++ 4 files changed, 29 insertions(+), 1 deletion(-) 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 999ce372ee..f7e54d3f3a 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 @@ -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; })); diff --git a/Open-ILS/src/eg2/src/app/share/catalog/catalog.service.ts b/Open-ILS/src/eg2/src/app/share/catalog/catalog.service.ts index 7a8951be43..dfdc38e2db 100644 --- a/Open-ILS/src/eg2/src/app/share/catalog/catalog.service.ts +++ b/Open-ILS/src/eg2/src/app/share/catalog/catalog.service.ts @@ -190,7 +190,8 @@ export class CatalogService { let observable: Observable; - const options: any = {}; + const options: any = {pref_ou: ctx.prefOu}; + if (ctx.showResultExtras) { options.flesh_copies = true; options.copy_depth = depth; diff --git a/Open-ILS/src/eg2/src/app/staff/catalog/result/record.component.html b/Open-ILS/src/eg2/src/app/staff/catalog/result/record.component.html index a48f33ce3b..4bd0fe13d6 100644 --- a/Open-ILS/src/eg2/src/app/staff/catalog/result/record.component.html +++ b/Open-ILS/src/eg2/src/app/staff/catalog/result/record.component.html @@ -79,6 +79,13 @@
+ +
Call Number: + {{summary.firstCallNumber.call_number_prefix_label}} + {{summary.firstCallNumber.call_number_label}} + {{summary.firstCallNumber.call_number_suffix_label}} +
+
Phys. Desc.: 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 be666349c7..98432e2e4e 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Search/Biblio.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Search/Biblio.pm @@ -3018,6 +3018,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); @@ -3098,6 +3101,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) = @_; -- 2.11.0