Bug 5631 : (MT #2993) add EAN, PUC and Music-Number indexes
[koha_fer] / C4 / XSLT.pm
old mode 100644 (file)
new mode 100755 (executable)
index 348930f..28a70fc
@@ -1,6 +1,8 @@
 package C4::XSLT;
 # Copyright (C) 2006 LibLime
 # <jmf at liblime dot com>
+# Parts Copyright Katrin Fischer 2011
+# Parts Copyright ByWater Solutions 2011
 #
 # This file is part of Koha.
 #
@@ -120,7 +122,7 @@ sub getAuthorisedValues4MARCSubfields {
 my $stylesheet;
 
 sub XSLTParse4Display {
-    my ( $biblionumber, $orig_record, $xsl_suffix, $interface ) = @_;
+    my ( $biblionumber, $orig_record, $xsl_suffix, $interface, $fixamps ) = @_;
     $interface = 'opac' unless $interface;
     # grab the XML, run it through our stylesheet, push it out to the browser
     my $record = transformMARCXML4XSLT($biblionumber, $orig_record);
@@ -131,7 +133,10 @@ sub XSLTParse4Display {
     foreach my $syspref ( qw/ hidelostitems OPACURLOpenInNewWindow
                               DisplayOPACiconsXSLT URLLinkText viewISBD
                               OPACBaseURL TraceCompleteSubfields
-                              UseAuthoritiesForTracings / )
+                              UseAuthoritiesForTracings TraceSubjectSubdivisions
+                              Display856uAsImage OPACDisplay856uAsImage 
+                              UseControlNumber
+                              AlternateHoldingsField AlternateHoldingsSeparator / )
     {
         my $sp = C4::Context->preference( $syspref );
         next unless defined($sp);
@@ -139,8 +144,11 @@ sub XSLTParse4Display {
     }
     $sysxml .= "</sysprefs>\n";
     $xmlrecord =~ s/\<\/record\>/$itemsxml$sysxml\<\/record\>/;
+    if ($fixamps) { # We need to correct the ampersand entities that Zebra outputs
+        $xmlrecord =~ s/\&amp;amp;/\&amp;/g;
+    }
     $xmlrecord =~ s/\& /\&amp\; /;
-    $xmlrecord=~ s/\&amp\;amp\; /\&amp\; /;
+    $xmlrecord =~ s/\&amp\;amp\; /\&amp\; /;
 
     my $parser = XML::LibXML->new();
     # don't die when you find &, >, etc