From e6649e8ede680e7cb75b2ba348b57a46e24706ec Mon Sep 17 00:00:00 2001 From: Aleisha Amohia Date: Wed, 23 Sep 2020 17:33:29 +1200 Subject: [PATCH] Bug 29990: Show authority appropriate heading use on search results Authority heading use is based on authority MARC 008/14-16. This could be useful to show on authority search results, if new system preference ShowHeadingUse is enabled. To test: 1. Apply patches, update database, restart services 2. Go to Koha Administration -> system preferences -> searching tab. Notice new ShowHeadingUse system preference is disabled. Leave it disabled for now. 3. Do an authority search. Confirm it works as expected and no new information is shown since ShowHeadingUse is disabled. 4. Do a biblio search and edit a record. Go to one of the authority fields (1xx, 6xx or 7xx) and launch the authority finder plugin. Do an authority search and confirm it works as expected and no new information is shown since ShowHeadingUse is disabled. 5. Go back to system preferences and enable ShowHeadingUse syspref. 6. Repeat steps 3 and 4 but confirm the 'Heading use' column now shows, and correctly displays what the heading can be used for based on 008/14-16. Sponsored-by: Education Services Australia SCIS --- C4/AuthoritiesMarc.pm | 12 ++++++++++++ .../en/modules/authorities/searchresultlist-auth.tt | 20 ++++++++++++++++++++ .../prog/en/modules/authorities/searchresultlist.tt | 20 ++++++++++++++++++++ 3 files changed, 52 insertions(+) diff --git a/C4/AuthoritiesMarc.pm b/C4/AuthoritiesMarc.pm index 36cbf5c43b..a7915e9056 100644 --- a/C4/AuthoritiesMarc.pm +++ b/C4/AuthoritiesMarc.pm @@ -301,6 +301,18 @@ sub SearchAuthorities { } my $summary = BuildSummary( $authrecord, $authid, $thisauthtypecode ); + if ( C4::Context->preference('ShowHeadingUse') ) { + # checking valid heading use + my $f008 = $authrecord->field('008'); + my $pos14to16 = substr( $f008->data, 14, 3 ); + my $main = substr( $pos14to16, 0, 1 ); + $newline{main} = 1 if $main eq 'a'; + my $subject = substr( $pos14to16, 1, 1); + $newline{subject} = 1 if $subject eq 'a'; + my $series = substr( $pos14to16, 2, 1 ); + $newline{series} = 1 if $series eq 'a'; + } + $newline{authtype} = defined($thisauthtype) ? $thisauthtype->authtypetext : ''; $newline{summary} = $summary; diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/authorities/searchresultlist-auth.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/authorities/searchresultlist-auth.tt index 71396e85e2..3bd3dc5653 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/authorities/searchresultlist-auth.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/authorities/searchresultlist-auth.tt @@ -1,11 +1,21 @@ [% USE raw %] [% USE Asset %] +[% USE Koha %] [% SET footerjs = 1 %] [% PROCESS 'authorities-search-results.inc' %] [% INCLUDE 'doc-head-open.inc' %] Cataloging authority plugin › Koha [% INCLUDE 'doc-head-close.inc' %] [% Asset.css("css/addbiblio.css") | $raw %] + @@ -45,6 +55,9 @@ Summary Heading type Used + [% IF Koha.Preference('ShowHeadingUse') %] + Heading use + [% END %] Get it! Other action @@ -53,6 +66,13 @@ [% PROCESS authresult summary=resul.summary authid=resul.authid %] [% resul.summary.label | html %] [% resul.used | html %] times + [% IF Koha.Preference('ShowHeadingUse') %] + + [% END %] [% IF resul.summary && resul.summary.authorized && resul.summary.authorized.size > 1 %] [% FOREACH authorized IN resul.summary.authorized %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/authorities/searchresultlist.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/authorities/searchresultlist.tt index 3baec6db23..4e6659a2fd 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/authorities/searchresultlist.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/authorities/searchresultlist.tt @@ -1,9 +1,19 @@ [% USE raw %] +[% USE Koha %] [% SET footerjs = 1 %] [% PROCESS 'authorities-search-results.inc' %] [% INCLUDE 'doc-head-open.inc' %] Authority search results › Authorities › Koha [% INCLUDE 'doc-head-close.inc' %] + @@ -49,6 +59,9 @@ [% UNLESS ( isEDITORS ) %] Used in [% END %] + [% IF Koha.Preference('ShowHeadingUse') %] + Heading use + [% END %] [% IF ( CAN_user_editauthorities ) %]   [% END %] @@ -66,6 +79,13 @@ [% END %] [% END %] + [% IF Koha.Preference('ShowHeadingUse') %] + + [% END %] [% IF ( CAN_user_editauthorities ) %]
-- 2.11.0