Bug 19361: Fix advanced cataloging editor dropdowns
[koha-ffzg.git] / opac / ilsdi.pl
index c9c01a9..5b10524 100755 (executable)
 use Modern::Perl;
 
 use C4::ILSDI::Services;
-use C4::Auth;
-use C4::Output;
+use C4::Auth qw( get_template_and_user );
+use C4::Output qw( output_html_with_http_headers );
 use C4::Context;
 
-use List::MoreUtils qw(any);
-use XML::Simple;
+use List::MoreUtils qw( any );
+use XML::Simple qw( XMLout );
 use CGI qw ( -utf8 );
 use Net::Netmask;
 
@@ -39,7 +39,7 @@ outputs the returned hashref as XML.
 =cut
 
 # Instanciate the CGI request
-my $cgi = new CGI;
+my $cgi = CGI->new;
 
 # List of available services, sorted by level
 my @services = (
@@ -100,7 +100,7 @@ my %required = (
 # List of optional arguments
 my %optional = (
     'Describe'            => [],
-    'GetAvailability'     => [ 'return_type', 'return_fmt' ],
+    'GetAvailability'     => [ 'return_type', 'return_fmt', 'language' ],
     'GetRecords'          => ['schema'],
     'GetAuthorityRecords' => ['schema'],
     'LookupPatron'        => ['id_type'],
@@ -121,7 +121,6 @@ unless ( $cgi->param('service') ) {
             query           => $cgi,
             type            => "opac",
             authnotrequired => 1,
-            debug           => 1,
         }
     );
     output_html_with_http_headers $cgi, $cookie, $template->output;
@@ -143,7 +142,6 @@ if ( scalar $cgi->param('service') eq "Describe" and any { scalar $cgi->param('v
             query           => $cgi,
             type            => "opac",
             authnotrequired => 1,
-            debug           => 1,
         }
     );
     $template->param( scalar $cgi->param('verb') => 1 );
@@ -164,19 +162,19 @@ unless ( C4::Context->preference('ILS-DI') ) {
 }
 
 # If the remote address is not allowed, redirect to 403
-my @AuthorizedIPs = split(/,/, C4::Context->preference('ILS-DI:AuthorizedIPs'));
-if ( @AuthorizedIPs ){ # If no filter set, allow access to everybody
+my @AuthorizedIPs = split( /,/, C4::Context->preference('ILS-DI:AuthorizedIPs') );
+if (@AuthorizedIPs) {    # If no filter set, allow access to everybody
     my $authorized = 0;
-    foreach my $ip (@AuthorizedIPs){
+    foreach my $ip (@AuthorizedIPs) {
         my $netmask = Net::Netmask->new2($ip);
-        if ( $netmask && $netmask->match($ENV{'REMOTE_ADDR'}) ){
+        if ( $netmask && $netmask->match( $ENV{REMOTE_ADDR} ) ) {
             $authorized = 1;
             last;
         }
     }
-    unless ($authorized){
+    unless ($authorized) {
         $out->{'code'} = "NotAllowed";
-        $out->{'message'} = "Unauthorized IP address: ".$ENV{'REMOTE_ADDR'}.".";
+        $out->{'message'} = "Unauthorized IP address: $ENV{REMOTE_ADDR}.";
     }
 }