Bug 31535: Fix warning - uninitialized value $mode in string ne (addbiblio.pl)
[srvgit] / authorities / auth_finder.pl
index e78a7d8..6927765 100755 (executable)
 # You should have received a copy of the GNU General Public License
 # along with Koha; if not, see <http://www.gnu.org/licenses>.
 
-use strict;
-use warnings;
+use Modern::Perl;
 
 use CGI qw ( -utf8 );
-use C4::Output;
-use C4::Auth;
+use C4::Output qw( output_html_with_http_headers );
+use C4::Auth qw( get_template_and_user );
 use C4::Context;
-use C4::Acquisition;
-use C4::Koha;
 use Koha::SearchEngine::Search;
 use Koha::SearchEngine::QueryBuilder;
 
 use Koha::Authority::Types;
 
-my $query        = new CGI;
+my $query        = CGI->new;
 my $op           = $query->param('op') || '';
 my $authtypecode = $query->param('authtypecode') || '';
 my $index        = $query->param('index') || '';
@@ -47,7 +44,6 @@ my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
         : 'authorities/auth_finder.tt',
         query           => $query,
         type            => 'intranet',
-        authnotrequired => 0,
         flagsrequired   => { catalogue => 1 },
     }
 );
@@ -78,6 +74,7 @@ if ( $op eq "do_search" ) {
         \@marclist, \@and_or, \@excluding, \@operator,
         \@value, $authtypecode, $orderby
     );
+    $template->param( search_query => $search_query ) if C4::Context->preference('DumpSearchQueryTemplate');
     my $offset = $startfrom * $resultsperpage;
     my ( $results, $total ) =
         $searcher->search_auth_compat( $search_query, $offset,
@@ -106,9 +103,9 @@ if ( $op eq "do_search" ) {
     push @field_data,
       { term => "value_main", val => scalar $query->param('value_main') || "" };
     push @field_data,
-      { term => "value_any", val => scalar $query->param('value_any') || "" };
-    push @field_data,
       { term => "value_match", val => scalar $query->param('value_match') || "" };
+    push @field_data,
+      { term => "value_any", val => scalar $query->param('value_any') || "" };
 
     my @numbers = ();
     if ( $total > $resultsperpage ) {
@@ -150,12 +147,10 @@ if ( $op eq "do_search" ) {
         from             => $from,
         to               => $to,
         numbers          => \@numbers,
-        operator_mainstr => ( @operator > 0 && $operator[0] )
-        ? $operator[0]
-        : '',
-        operator_main  => ( @operator > 1 && $operator[1] ) ? $operator[1] : '',
-        operator_any   => ( @operator > 2 && $operator[2] ) ? $operator[2] : '',
-        operator_match => ( @operator > 3 && $operator[3] ) ? $operator[3] : '',
+        operator_mainstr => ( @operator > 0 && $operator[0] ) ? $operator[0] : '',
+        operator_main    => ( @operator > 1 && $operator[1] ) ? $operator[1] : '',
+        operator_match   => ( @operator > 2 && $operator[2] ) ? $operator[2] : '',
+        operator_any     => ( @operator > 3 && $operator[3] ) ? $operator[3] : '',
     );
 }
 else {