Bug 20088: Fix uninitialized warning from svc/holds
authorMarcel de Rooy <m.de.rooy@rijksmuseum.nl>
Thu, 25 Jan 2018 11:01:30 +0000 (12:01 +0100)
committerJonathan Druart <jonathan.druart@bugs.koha-community.org>
Tue, 30 Jan 2018 17:21:27 +0000 (14:21 -0300)
Use of uninitialized value in array element at svc/holds line 56.

Test plan:
Check if the warn is no longer in the logs; the warning is triggered by
an ajax call from the circulation template in staff.

Signed-off-by: Mark Tompsett <mtompset@hotmail.com>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

svc/holds

index 5c0ed35..062109d 100755 (executable)
--- a/svc/holds
+++ b/svc/holds
@@ -54,8 +54,8 @@ my $borrowernumber    = $input->param('borrowernumber');
 my $offset            = $input->param('iDisplayStart');
 my $results_per_page  = $input->param('iDisplayLength');
 my $sorting_direction = $input->param('sSortDir_0') || 'desc';
-my $sorting_column    = $sort_columns[ $input->param('iSortCol_0') ]
-  || 'reservedate';
+my $iSortCol          = $input->param('iSortCol_0') // 0;
+my $sorting_column    = $sort_columns[$iSortCol] // 'reservedate';
 
 binmode STDOUT, ":encoding(UTF-8)";
 print $input->header( -type => 'text/plain', -charset => 'UTF-8' );