Bug 18854: Protect few other occurrences of offset
authorJonathan Druart <jonathan.druart@bugs.koha-community.org>
Mon, 10 Jul 2017 14:56:46 +0000 (11:56 -0300)
committerJonathan Druart <jonathan.druart@bugs.koha-community.org>
Fri, 14 Jul 2017 15:02:04 +0000 (12:02 -0300)
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
C4/AuthoritiesMarc.pm
Koha/SearchEngine/Elasticsearch/Search.pm
admin/auth_subfields_structure.pl
admin/auth_tag_structure.pl
admin/marc_subfields_structure.pl

index 87620b4..9f1f284 100644 (file)
@@ -240,7 +240,7 @@ sub SearchAuthorities {
         $query="\@or $orderstring $query" if $orderstring;
     }
 
-    $offset=0 unless $offset;
+    $offset = 0 if not defined $offset or $offset < 0;
     my $counter = $offset;
     $length=10 unless $length;
     my @oAuth;
index 9f0e2a5..cec1cb7 100644 (file)
@@ -327,7 +327,8 @@ sub simple_search_compat {
     return ('No query entered', undef, undef) unless $query;
 
     my %options;
-    $options{offset} = $offset // 0;
+    $offset = 0 if not defined $offset or $offset < 0;
+    $options{offset} = $offset;
     $max_results //= 100;
 
     unless (ref $query) {
index 0ba7677..37249e6 100755 (executable)
@@ -52,7 +52,8 @@ my $input        = new CGI;
 my $tagfield     = $input->param('tagfield');
 my $tagsubfield  = $input->param('tagsubfield');
 my $authtypecode = $input->param('authtypecode');
-my $offset       = $input->param('offset') || 0;
+my $offset       = $input->param('offset');
+$offset = 0 if not defined $offset or $offset < 0;
 my $op           = $input->param('op') || '';
 my $script_name  = "/cgi-bin/koha/admin/auth_subfields_structure.pl";
 
index 4a3a67a..ddf163a 100755 (executable)
@@ -35,7 +35,8 @@ my $authtypecode         = $input->param('authtypecode')         || '';    # set
 my $existingauthtypecode = $input->param('existingauthtypecode') || '';    # set when we have to create a new framework (in authtype) by copying an old one (in existingauthtype)
 
 my $searchfield = $input->param('searchfield') || 0;
-my $offset      = $input->param('offset') || 0;
+my $offset      = $input->param('offset');
+$offset = 0 if not defined $offset or $offset < 0;
 my $op          = $input->param('op')     || '';
 $searchfield =~ s/\,//g;
 
index 24c8005..077a58b 100755 (executable)
@@ -65,7 +65,8 @@ my $tagfield      = $input->param('tagfield');
 my $tagsubfield   = $input->param('tagsubfield');
 my $frameworkcode = $input->param('frameworkcode');
 my $pkfield       = "tagfield";
-my $offset        = $input->param('offset') || 0;
+my $offset        = $input->param('offset');
+$offset = 0 if not defined $offset or $offset < 0;
 my $script_name   = "/cgi-bin/koha/admin/marc_subfields_structure.pl";
 
 my ( $template, $borrowernumber, $cookie ) = get_template_and_user(