Bug 19502: Retrieve index.max_result_window from ES
[koha.git] / catalogue / showmarc.pl
blob13bde06693e79b5942f986129a0a5cc85f1f310e
1 #!/usr/bin/perl
3 # Koha library project www.koha-community.org
5 # Copyright 2007 Liblime
6 # Parts copyright 2010 BibLibre
8 # This file is part of Koha.
10 # Koha is free software; you can redistribute it and/or modify it under the
11 # terms of the GNU General Public License as published by the Free Software
12 # Foundation; either version 3 of the License, or (at your option) any later
13 # version.
15 # Koha is distributed in the hope that it will be useful, but WITHOUT ANY
16 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
17 # A PARTICULAR PURPOSE. See the GNU General Public License for more details.
19 # You should have received a copy of the GNU General Public License along
20 # with Koha; if not, write to the Free Software Foundation, Inc.,
21 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
23 use Modern::Perl;
25 # standard or CPAN modules used
26 use CGI qw(:standard -utf8);
27 use DBI;
28 use Encode;
30 # Koha modules used
31 use C4::Context;
32 use C4::Output;
33 use C4::Auth;
34 use C4::Biblio;
35 use C4::ImportBatch;
36 use C4::XSLT ();
38 my $input= new CGI;
39 my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
41 template_name => "catalogue/showmarc.tt",
42 query => $input,
43 type => "intranet",
44 authnotrequired => 0,
45 flagsrequired => { catalogue => 1 },
46 debug => 1,
50 my $biblionumber= $input->param('id');
51 my $importid= $input->param('importid');
52 my $view= $input->param('viewas')||'';
54 my $record;
55 if ($importid) {
56 $record = C4::ImportBatch::GetRecordFromImportBiblio( $importid, 'embed_items' );
58 else {
59 $record =GetMarcBiblio({ biblionumber => $biblionumber });
61 if(!ref $record) {
62 print $input->redirect("/cgi-bin/koha/errors/404.pl");
63 exit;
66 if($view eq 'card' || $view eq 'html') {
67 my $xml = $importid ? $record->as_xml(): GetXmlBiblio($biblionumber);
68 my $xsl;
69 if ( $view eq 'card' ){
70 $xsl = C4::Context->preference('marcflavour') eq 'UNIMARC'
71 ? 'UNIMARC_compact.xsl' : 'compact.xsl';
73 else {
74 $xsl = 'plainMARC.xsl';
76 my $htdocs = C4::Context->config('intrahtdocs');
77 my ($theme, $lang) = C4::Templates::themelanguage($htdocs, $xsl, 'intranet', $input);
78 $xsl = "$htdocs/$theme/$lang/xslt/$xsl";
79 print $input->header(-charset => 'UTF-8'),
80 Encode::encode_utf8(C4::XSLT::engine->transform($xml, $xsl));
82 else {
83 $template->param( MARC_FORMATTED => $record->as_formatted );
84 output_html_with_http_headers $input, $cookie, $template->output;