ffzg/recall_notices.pl: added --interval and --dedup
[koha.git] / opac / opac-showmarc.pl
index 250c519..232eac5 100755 (executable)
@@ -34,6 +34,13 @@ use C4::Templates;
 use Koha::RecordProcessor;
 
 my $input       = new CGI;
+my ( $template, $loggedinuser, $cookie ) = get_template_and_user({
+    template_name   => "opac-showmarc.tt",
+    query           => $input,
+    type            => "opac",
+    authnotrequired => ( C4::Context->preference("OpacPublic") ? 1 : 0 ),
+    debug           => 1,
+});
 my $biblionumber = $input->param('id');
 $biblionumber   = int($biblionumber);
 my $importid= $input->param('importid');
@@ -47,7 +54,7 @@ if ($importid) {
     $record = MARC::Record->new_from_usmarc($marc);
 }
 else {
-    $record = GetMarcBiblio($biblionumber);
+    $record = GetMarcBiblio({ biblionumber => $biblionumber });
     my $framework = GetFrameworkCode($biblionumber);
     $record_processor->options({
         interface => 'opac',
@@ -68,17 +75,9 @@ if ($view eq 'card' || $view eq 'html') {
     my $htdocs = C4::Context->config('opachtdocs');
     my ($theme, $lang) = C4::Templates::themelanguage($htdocs, $xsl, 'opac', $input);
     $xsl = "$htdocs/$theme/$lang/xslt/$xsl";
-    print $input->header(-charset => 'UTF-8'),
-          Encode::encode_utf8(C4::XSLT::engine->transform($xml, $xsl));
+    output_html_with_http_headers $input, undef, Encode::encode_utf8(C4::XSLT::engine->transform($xml, $xsl));
 }
 else { #view eq marc
-    my ( $template, $loggedinuser, $cookie ) = get_template_and_user({
-        template_name   => "opac-showmarc.tt",
-        query           => $input,
-        type            => "opac",
-        authnotrequired => ( C4::Context->preference("OpacPublic") ? 1 : 0 ),
-        debug           => 1,
-    });
     $template->param( MARC_FORMATTED => $record->as_formatted );
     output_html_with_http_headers $input, $cookie, $template->output;
 }