[Koha-patches] [SIGNED OFF] Bug 5727 Warning in log due to XSLT.pm

Colin Campbell colin.campbell at ptfs-europe.com
Thu Feb 10 18:42:53 CET 2011


From: Frédéric Demians <f.demians at tamil.fr>

XSLT.pm add few syspref to MARCXML record send to be transformed by XSLT. If
one of those syspref doesn't exist, it generated a warning.

Signed-off-by: Colin Campbell <colin.campbell at ptfs-europe.com>
---
 C4/XSLT.pm |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/C4/XSLT.pm b/C4/XSLT.pm
index 7844330..f1c5293 100644
--- a/C4/XSLT.pm
+++ b/C4/XSLT.pm
@@ -129,9 +129,9 @@ sub XSLTParse4Display {
     my $xmlrecord = $record->as_xml(C4::Context->preference('marcflavour'));
     my $sysxml = "<sysprefs>\n";
     foreach my $syspref ( qw/OPACURLOpenInNewWindow DisplayOPACiconsXSLT URLLinkText viewISBD OPACBaseURL/ ) {
-        $sysxml .= "<syspref name=\"$syspref\">" .
-                   C4::Context->preference( $syspref ) .
-                   "</syspref>\n";
+        my $sp = C4::Context->preference( $syspref );
+        next unless defined($sp);
+        $sysxml .= "<syspref name=\"$syspref\">$sp</syspref>\n";
     }
     $sysxml .= "</sysprefs>\n";
     $xmlrecord =~ s/\<\/record\>/$itemsxml$sysxml\<\/record\>/;
-- 
1.7.4



More information about the Koha-patches mailing list