Bug 23156: Add pagination to checkouts in ILS-DI GetPatronInfo service
[koha-equinox.git] / opac / ilsdi.pl
index 2ff65b5..346f23e 100755 (executable)
@@ -32,7 +32,7 @@ use CGI qw ( -utf8 );
 
 This script is a basic implementation of ILS-DI protocol for Koha.
 It acts like a dispatcher, that get the CGI request, check required and 
-optionals arguments, call a function from C4::ILS-DI, and finaly
+optionals arguments, call a function from C4::ILS-DI, and finally
 outputs the returned hashref as XML.
 
 =cut
@@ -47,7 +47,7 @@ my @services = (
     #  Level 1: Basic Discovery Interfaces
     #  'HarvestBibliographicRecords',       # OAI-PMH
     #  'HarvestExpandedRecords',            # OAI-PMH
-    'GetAvailability',    # FIXME Add bibbliographic level
+    'GetAvailability',    # FIXME Add bibliographic level
 
     #  'GoToBibliographicRequestPage'       # I don't understant this one
     #  Level 2: Elementary OPAC supplement
@@ -104,7 +104,7 @@ my %optional = (
     'GetAuthorityRecords' => ['schema'],
     'LookupPatron'        => ['id_type'],
     'AuthenticatePatron'  => [],
-    'GetPatronInfo'       => [ 'show_contact', 'show_fines', 'show_holds', 'show_loans', 'show_attributes' ],
+    'GetPatronInfo'       => [ 'show_contact', 'show_fines', 'show_holds', 'show_loans', 'loans_per_page', 'loans_page', 'show_attributes' ],
     'GetPatronStatus'     => [],
     'GetServices'         => [],
     'RenewLoan'           => ['desired_due_date'],
@@ -128,7 +128,7 @@ unless ( $cgi->param('service') ) {
 }
 
 # If user requested a service description, then display it
-if ( $cgi->param('service') eq "Describe" and any { $cgi->param('verb') eq $_ } @services ) {
+if ( scalar $cgi->param('service') eq "Describe" and any { scalar $cgi->param('verb') eq $_ } @services ) {
     my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
         {   template_name   => "ilsdi.tt",
             query           => $cgi,
@@ -137,7 +137,7 @@ if ( $cgi->param('service') eq "Describe" and any { $cgi->param('verb') eq $_ }
             debug           => 1,
         }
     );
-    $template->param( $cgi->param('verb') => 1 );
+    $template->param( scalar $cgi->param('verb') => 1 );
     output_html_with_http_headers $cgi, $cookie, $template->output;
     exit 0;
 }
@@ -171,7 +171,7 @@ if ( $service and any { $service eq $_ } @services ) {
     my @parmsrequired = @{ $required{$service} };
     my @parmsoptional = @{ $optional{$service} };
     my @parmsall      = ( @parmsrequired, @parmsoptional );
-    my @names         = $cgi->param;
+    my @names         = $cgi->multi_param;
     my %paramhash;
     $paramhash{$_} = 1 for @names;
 
@@ -199,7 +199,7 @@ if ( $service and any { $service eq $_ } @services ) {
 
     # check for multiple parameters
     for ( @names ) {
-        my @values = $cgi->param($_);
+        my @values = $cgi->multi_param($_);
         if ( $#values != 0 ) {
             $out->{'code'} = "MultipleValuesNotAllowed";
             $out->{'message'} = "Multiple values not allowed for the parameter ".$_.".";