Bug 10986: add system preference to limit the list of languages in advanced search
[koha_fer] / opac / ilsdi.pl
index 4f4b177..d68f09a 100755 (executable)
@@ -20,6 +20,8 @@
 use strict;
 use warnings;
 
+use List::MoreUtils qw(any);
+
 use C4::ILSDI::Services;
 use C4::Auth;
 use C4::Output;
@@ -141,6 +143,10 @@ if ( $cgi->param('service') eq "Describe" and any { $cgi->param('verb') eq $_ }
     exit 0;
 }
 
+# any output after this point will be UTF-8 XML
+binmode STDOUT, ':encoding(UTF-8)';
+print CGI::header('-type'=>'text/xml', '-charset'=>'utf-8');
+
 my $out;
 
 # If ILS-DI module is disabled in System->Preferences, redirect to 404
@@ -205,8 +211,7 @@ if ( $service and any { $service eq $_ } @services ) {
 
         # GetAvailability is a special case, as it cannot use XML::Simple
         if ( $service eq "GetAvailability" ) {
-            print CGI::header('text/xml');
-            print C4::ILSDI::GetAvailability($cgi);
+            print C4::ILSDI::Services::GetAvailability($cgi);
             exit 0;
         } else {
 
@@ -226,11 +231,9 @@ if ( $service and any { $service eq $_ } @services ) {
 }
 
 # Output XML by passing the hashref to XMLOut
-print CGI::header('-type'=>'text/xml', '-charset'=>'utf-8');
 print XMLout(
     $out,
     noattr        => 1,
-    noescape      => 1,
     nosort        => 1,
     xmldecl       => '<?xml version="1.0" encoding="UTF-8" ?>',
     RootName      => $service,