From 62d96cffe149063a3f25eb6dba93015bd6ce4691 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 Signed-off-by: Jessica Signed-off-by: Nick Clemens Signed-off-by: Fridolin Somers --- C4/AuthoritiesMarc.pm | 12 +++++++++++ .../authorities/searchresultlist-auth.tt | 20 +++++++++++++++++++ .../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 ea9754225a..d60a3ce1df 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 auth_preview=1 %] [% resul.summary.label | html %] [% resul.used | html %] times + [% IF Koha.Preference('ShowHeadingUse') %] +
    +
  • [% IF resul.main %][% ELSE %][% END %] Main/Added Entry
  • +
  • [% IF resul.subject %][% ELSE %][% END %] Subject
  • +
  • [% IF resul.series %][% ELSE %][% END %] Series Title
  • +
+ [% 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 466b54779c..7d0c25b401 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/authorities/searchresultlist.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/authorities/searchresultlist.tt @@ -1,11 +1,21 @@ [% USE raw %] [% USE Asset %] +[% 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' %] [% Asset.css("css/addbiblio.css") | $raw %] + @@ -51,6 +61,9 @@ [% UNLESS ( isEDITORS ) %] Used in [% END %] + [% IF Koha.Preference('ShowHeadingUse') %] + Heading use + [% END %] [% IF ( CAN_user_editauthorities ) %]   [% END %] @@ -74,6 +87,13 @@ [% END %] [% END %] + [% IF Koha.Preference('ShowHeadingUse') %] +
    +
  • [% IF resul.main %][% ELSE %][% END %] Main/Added Entry
  • +
  • [% IF resul.subject %][% ELSE %][% END %] Subject
  • +
  • [% IF resul.series %][% ELSE %][% END %] Series Title
  • +
+ [% END %] [% IF ( CAN_user_editauthorities ) %]
-- 2.39.5