From ee27ae4a72540a6685f503895a55c5e636fdc154 Mon Sep 17 00:00:00 2001 From: Bill Erickson Date: Fri, 24 Apr 2020 16:09:57 -0400 Subject: [PATCH] LP1874897 Staff catalog honors classification scheme Use the org unit setting "cat.default_classification_scheme" to determine which scheme to use when extracting the bib-level call number for display in the Angular staff catalog. This also modifies the API to look the value up so future calls to the API will Just Work (and it's one less bit of data the browser has to retrieve). Signed-off-by: Bill Erickson Signed-off-by: Jane Sandberg Signed-off-by: Galen Charlton --- .../src/app/share/catalog/bib-record.service.ts | 5 +---- .../src/perlmods/lib/OpenILS/Application/Cat.pm | 16 +++++++++++++--- 2 files changed, 14 insertions(+), 7 deletions(-) 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 83d66c0654..d29c4bdef8 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 @@ -108,13 +108,10 @@ export class BibRecordSummary { return Promise.resolve(this.bibCallNumber); } - // TODO labelClass = cat.default_classification_scheme YAOUS - const labelClass = 1; - return this.net.request( 'open-ils.cat', 'open-ils.cat.biblio.record.marc_cn.retrieve', - this.id, labelClass + this.id, null, this.orgId ).toPromise().then(cnArray => { if (cnArray && cnArray.length > 0) { const key1 = Object.keys(cnArray[0])[0]; diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Cat.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Cat.pm index 4c4d977cca..9f413b04c3 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Cat.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Cat.pm @@ -500,24 +500,34 @@ __PACKAGE__->register_method( params => [ {desc => 'Record ID', type => 'number'}, {desc => '(Optional) Classification scheme ID', type => 'number'}, + {desc => '(Optional) Context org unit ID for default classification lookup', type => 'number'}, ] }, return => {desc => 'Hash of candidate call numbers identified by tag' } ); sub biblio_record_marc_cn { - my( $self, $client, $id, $class ) = @_; + my( $self, $client, $id, $class, $ctx_org_id ) = @_; my $e = new_editor(); - my $marc = $e->retrieve_biblio_record_entry($id)->marc; + my $bre = $e->retrieve_biblio_record_entry($id); + my $marc = $bre->marc; my $doc = XML::LibXML->new->parse_string($marc); $doc->documentElement->setNamespace( "http://www.loc.gov/MARC21/slim", "marc", 1 ); + if (!$class) { + my $ctx_org = $ctx_org_id || $bre->owner || $U->get_org_tree->id; # root org + $class = $U->ou_ancestor_setting_value( + $ctx_org, 'cat.default_classification_scheme', $e); + } + my @fields; my @res; if ($class) { - @fields = split(/,/, $e->retrieve_asset_call_number_class($class)->field); + # be sure the class ID provided exists. + my $cn_class = $e->retrieve_asset_call_number_class($class) or return $e->event; + @fields = split(/,/, $cn_class->field); } else { @fields = qw/050ab 055ab 060ab 070ab 080ab 082ab 086ab 088ab 090 092 096 098 099/; } -- 2.43.2