From fafa6ecaa0049fa3564493190684c9f7c11f5789 Mon Sep 17 00:00:00 2001 From: Timothy Alexis Vass Date: Wed, 28 Apr 2021 11:21:27 +0200 Subject: [PATCH] Bug 28247: Add a MARC preview column to to Authority search results table To test: 1) Do an authority search 2) Notice the MARC preview column 3) Click "Show" for some of the results. 4) Confirm that the correct details are shown. 5) Sign off. --- authorities/showmarc.pl | 77 +++++++++++++++++++ .../modules/authorities/searchresultlist.tt | 31 ++++++++ .../prog/en/modules/authorities/showmarc.tt | 10 +++ 3 files changed, 118 insertions(+) create mode 100755 authorities/showmarc.pl create mode 100644 koha-tmpl/intranet-tmpl/prog/en/modules/authorities/showmarc.tt diff --git a/authorities/showmarc.pl b/authorities/showmarc.pl new file mode 100755 index 0000000000..4d6f722928 --- /dev/null +++ b/authorities/showmarc.pl @@ -0,0 +1,77 @@ +#!/usr/bin/perl + +# Koha library project www.koha-community.org + +# Copyright 2007 Liblime +# Parts copyright 2010 BibLibre +# +# This file is part of Koha. +# +# Koha is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# Koha is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Koha; if not, see . + +use Modern::Perl; + +# standard or CPAN modules used +use CGI qw(:standard -utf8); +use DBI; +use Encode; + +# Koha modules used +use C4::Context; +use C4::Output; +use C4::Auth; +use C4::AuthoritiesMarc; +use C4::XSLT (); + +my $input= CGI->new; +my ( $template, $loggedinuser, $cookie ) = get_template_and_user( + { + template_name => "authorities/showmarc.tt", + query => $input, + type => "intranet", + flagsrequired => { authorities => 1 }, + debug => 1, + } +); + +my $authid = $input->param('id'); +my $view = $input->param('viewas')||''; + +my $record = GetAuthority($authid); + +if(!ref $record) { + print $input->redirect("/cgi-bin/koha/errors/404.pl"); + exit; +} + +if($view eq 'card' || $view eq 'html') { + my $xml = GetAuthorityXML($authid); + my $xsl; + if ( $view eq 'card' ){ + $xsl = C4::Context->preference('marcflavour') eq 'UNIMARC' + ? 'UNIMARC_compact.xsl' : 'compact.xsl'; + } + else { + $xsl = 'plainMARC.xsl'; + } + my $htdocs = C4::Context->config('intrahtdocs'); + my ($theme, $lang) = C4::Templates::themelanguage($htdocs, $xsl, 'intranet', $input); + $xsl = "$htdocs/$theme/$lang/xslt/$xsl"; + print $input->header(-charset => 'UTF-8'), + Encode::encode_utf8(C4::XSLT::engine->transform($xml, $xsl)); +} +else { + $template->param( MARC_FORMATTED => $record->as_formatted ); + output_html_with_http_headers $input, $cookie, $template->output; +} 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..8fcc9d2988 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/authorities/searchresultlist.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/authorities/searchresultlist.tt @@ -45,6 +45,7 @@ + [% UNLESS ( isEDITORS ) %] @@ -57,6 +58,7 @@ + [% UNLESS ( resul.isEDITORS ) %]
SummaryMARC preview Heading typeUsed in
[% PROCESS authresult summary=resul.summary authid=resul.authid %] [% resul.authtype | html %]Show [% IF resul.used > 0 %] @@ -94,8 +96,37 @@ + + [% MACRO jsinclude BLOCK %] [% INCLUDE 'authorities_js.inc' %] [% END %] [% INCLUDE 'intranet-bottom.inc' %] + + \ No newline at end of file diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/authorities/showmarc.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/authorities/showmarc.tt new file mode 100644 index 0000000000..47ce4ff6d9 --- /dev/null +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/authorities/showmarc.tt @@ -0,0 +1,10 @@ + [% INCLUDE 'doc-head-open.inc' %] + Koha › Authorities › MARC preview + + + +
+
[% MARC_FORMATTED | html %]
+
+ + -- 2.25.1