From 17291775876e56f3de190af4fb6e3442396d03d8 Mon Sep 17 00:00:00 2001 From: Chris Cormack Date: Tue, 21 Dec 2010 17:12:49 +1300 Subject: [PATCH] Bug 5106: Tidy up code in opac-showmarc.pl --- opac/opac-showmarc.pl | 27 ++++++++++----------------- 1 file changed, 10 insertions(+), 17 deletions(-) diff --git a/opac/opac-showmarc.pl b/opac/opac-showmarc.pl index 9c70d5684a..2e0be7527a 100755 --- a/opac/opac-showmarc.pl +++ b/opac/opac-showmarc.pl @@ -61,23 +61,17 @@ if ($importid) { $xmlrecord = $record->as_xml(); } } - -if ($view eq 'card') { - $xmlrecord = GetXmlBiblio($biblionumber) unless $xmlrecord; - my $xslfile = C4::Context->config('opachtdocs')."/prog/en/xslt/compact.xsl"; - my $parser = XML::LibXML->new(); - my $xslt = XML::LibXSLT->new(); - my $source = $parser->parse_string($xmlrecord); - my $style_doc = $parser->parse_file($xslfile); - my $stylesheet = $xslt->parse_stylesheet($style_doc); - my $results = $stylesheet->transform($source); - my $newxmlrecord = $stylesheet->output_string($results); - #warn $newxmlrecord; - print $input->header(), $newxmlrecord; - exit; -} elsif ($view eq 'html'){ + + +if ($view eq 'card' || $view eq 'html') { $xmlrecord = GetXmlBiblio($biblionumber) unless $xmlrecord; - my $xslfile = C4::Context->config('opachtdocs')."/prog/en/xslt/MARC21slim2OPACMARCdetail.xsl"; + my $xslfile; + if ($view eq 'card'){ + $xslfile = C4::Context->config('opachtdocs')."/prog/en/xslt/compact.xsl"; + } + else { # must be html + $xslfile = C4::Context->config('opachtdocs')."/prog/en/xslt/MARC21slim2OPACMARCdetail.xsl"; + } my $parser = XML::LibXML->new(); my $xslt = XML::LibXSLT->new(); my $source = $parser->parse_string($xmlrecord); @@ -85,7 +79,6 @@ if ($view eq 'card') { my $stylesheet = $xslt->parse_stylesheet($style_doc); my $results = $stylesheet->transform($source); my $newxmlrecord = $stylesheet->output_string($results); - #warn $newxmlrecord; print $input->header(), $newxmlrecord; exit; } else { -- 2.39.5