Bug 18374: (QA follow-up) Remove warning in Elasticsearch/Search.pm
authorTomas Cohen Arazi <tomascohen@theke.io>
Tue, 12 Sep 2017 15:15:07 +0000 (12:15 -0300)
committerJonathan Druart <jonathan.druart@bugs.koha-community.org>
Fri, 13 Oct 2017 16:57:27 +0000 (13:57 -0300)
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Koha/SearchEngine/Elasticsearch/Search.pm

index cec1cb7..4d584f7 100644 (file)
@@ -148,8 +148,10 @@ sub search_compat {
         $branches, $query_type,       $scan
     ) = @_;
     my %options;
+    if ( !defined $offset or $offset < 0 ) {
+        $offset = 0;
+    }
     $options{offset} = $offset;
-    $offset = 0 if $offset < 0;
     $options{expanded_facet} = $expanded_facet;
     my $results = $self->search($query, undef, $results_per_page, %options);