[Koha-patches] [PATCH] Bug 3098 - Append OPAC sysprefs into XML biblio record to be passed to XSLT

Frédéric Demians f.demians at tamil.fr
Fri Jul 24 18:54:06 CEST 2009


MARCXML biblio record looks like that:

<record>
...
<sysprefs>
<syspref name="OPACURLOpenInNewWindow">0</syspref>
</sysprefs>
</record>
---
 C4/XSLT.pm |    9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)

diff --git a/C4/XSLT.pm b/C4/XSLT.pm
index 76e7ea7..89ab3a0 100644
--- a/C4/XSLT.pm
+++ b/C4/XSLT.pm
@@ -124,7 +124,14 @@ sub XSLTParse4Display {
     #return $record->as_formatted();
     my $itemsxml  = buildKohaItemsNamespace($biblionumber);
     my $xmlrecord = $record->as_xml();
-    $xmlrecord =~ s/\<\/record\>/$itemsxml\<\/record\>/;
+    my $sysxml = "<sysprefs>\n";
+    foreach my $syspref ( qw( OPACURLOpenInNewWindow ) ) {
+        $sysxml .= "<syspref name=\"$syspref\">" .
+                   C4::Context->preference( $syspref ) .
+                   "</syspref>\n";
+    }
+    $sysxml .= "</sysprefs>\n";
+    $xmlrecord =~ s/\<\/record\>/$itemsxml$sysxml\<\/record\>/;
     my $parser = XML::LibXML->new();
     # don't die when you find &, >, etc
     $parser->recover_silently(1);
-- 
1.5.6.5




More information about the Koha-patches mailing list