From: Galen Charlton Date: Wed, 9 Sep 2020 18:57:47 +0000 (-0400) Subject: LP#1879335: (follow-up) improve extraction of thesaurus X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=d6fca5ebf728eb126b2bb6b66fa04dd18b0f69be;p=evergreen%2Fmasslnc.git LP#1879335: (follow-up) improve extraction of thesaurus Use the stored procedure authority.extract_thesaurus(), which knows how to grab the thesaurus from the 040 when necessary. This also renames the "Thesaurus" column in the display grid to "Thesaurus (Short Code)", which corresponds to the 008 thesarus position, and "Thesaurus Code" to "Thesaurus" Signed-off-by: Galen Charlton Signed-off-by: Bill Erickson Signed-off-by: Galen Charlton --- diff --git a/Open-ILS/src/eg2/src/app/staff/cat/authority/browse.component.html b/Open-ILS/src/eg2/src/app/staff/cat/authority/browse.component.html index 0b548a590b..6dc79b5456 100644 --- a/Open-ILS/src/eg2/src/app/staff/cat/authority/browse.component.html +++ b/Open-ILS/src/eg2/src/app/staff/cat/authority/browse.component.html @@ -77,8 +77,8 @@ [cellTemplate]="headingTemplate"> - - + diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Search/Authority.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Search/Authority.pm index 47c52b4257..277891248d 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Search/Authority.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Search/Authority.pm @@ -412,18 +412,17 @@ sub authority_main_entry { my $field_008 = $marc->field('008'); if ($field_008) { - # Extract the 1-char thesaurus code from the 008. - my $thes = substr($field_008->data, 11, 1); + my $extract_thesaurus_query = { + from => [ 'authority.extract_thesaurus' => $rec->marc ] + }; + my $thes = $e->json_query($extract_thesaurus_query)->[0]->{'authority.extract_thesaurus'}; if (defined $thes) { - $response->{thesaurus} = $thes; + $response->{thesaurus_code} = $thes; + my $thesaurus = $e->search_authority_thesaurus( + {code => $thes})->[0]; - if ($thes ne 'z') { # 'z' ('Other') maps to many entries - my $thesaurus = $e->search_authority_thesaurus( - {short_code => $thes})->[0]; - - $response->{thesaurus_code} = $thesaurus->code if $thesaurus; - } + $response->{thesaurus} = $thesaurus->short_code if $thesaurus; } }