From ae61f7c4f170e292781598c3123cc4a70863d933 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Thu, 15 Dec 2016 13:50:42 +0100 Subject: [PATCH] Bug 16951: Replace some more In order to avoid warnings in the logs, $cgi->param should be forced to scalar context Signed-off-by: Katrin Fischer Signed-off-by: Nick Clemens Signed-off-by: Kyle M Hall (cherry picked from commit e16ec2fcdb8bf67c507591386f94b9d024fec596) Signed-off-by: Katrin Fischer --- catalogue/itemsearch.pl | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/catalogue/itemsearch.pl b/catalogue/itemsearch.pl index 49e56eef7a..fa6b357b9f 100755 --- a/catalogue/itemsearch.pl +++ b/catalogue/itemsearch.pl @@ -42,18 +42,19 @@ if (defined $format and $format eq 'json') { $content_type = 'json'; # Map DataTables parameters with 'regular' parameters - $cgi->param('rows', $cgi->param('iDisplayLength')); - $cgi->param('page', ($cgi->param('iDisplayStart') / $cgi->param('iDisplayLength')) + 1); + $cgi->param('rows', scalar $cgi->param('iDisplayLength')); + $cgi->param('page', (scalar $cgi->param('iDisplayStart') / scalar $cgi->param('iDisplayLength')) + 1); my @columns = split /,/, scalar $cgi->param('sColumns'); - $cgi->param('sortby', $columns[ $cgi->param('iSortCol_0') ]); - $cgi->param('sortorder', $cgi->param('sSortDir_0')); + $cgi->param('sortby', $columns[ scalar $cgi->param('iSortCol_0') ]); + $cgi->param('sortorder', scalar $cgi->param('sSortDir_0')); my @f = $cgi->multi_param('f'); my @q = $cgi->multi_param('q'); push @q, '' if @q == 0; my @op = $cgi->multi_param('op'); my @c = $cgi->multi_param('c'); - foreach my $i (0 .. ($cgi->param('iColumns') - 1)) { + my $iColumns = $cgi->param('iColumns'); + foreach my $i (0 .. ($iColumns - 1)) { my $sSearch = $cgi->param("sSearch_$i"); if (defined $sSearch and $sSearch ne '') { my @words = split /\s+/, $sSearch; @@ -109,7 +110,7 @@ if (scalar keys %params > 0) { field => $p, query => \@q, }; - if (my $op = $cgi->param($p . '_op')) { + if (my $op = scalar $cgi->param($p . '_op')) { $f->{operator} = $op; } push @{ $filter->{filters} }, $f; @@ -170,14 +171,14 @@ if (scalar keys %params > 0) { } } - if (my $itemcallnumber_from = $cgi->param('itemcallnumber_from')) { + if (my $itemcallnumber_from = scalar $cgi->param('itemcallnumber_from')) { push @{ $filter->{filters} }, { field => 'itemcallnumber', query => $itemcallnumber_from, operator => '>=', }; } - if (my $itemcallnumber_to = $cgi->param('itemcallnumber_to')) { + if (my $itemcallnumber_to = scalar $cgi->param('itemcallnumber_to')) { push @{ $filter->{filters} }, { field => 'itemcallnumber', query => $itemcallnumber_to, -- 2.39.5