Bug 26265: (QA follow-up) Remove g option from regex, add few dirs
[koha-equinox.git] / cataloguing / z3950_auth_search.pl
index 3ab7666..1e25468 100755 (executable)
@@ -16,8 +16,8 @@
 # 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::Auth;
@@ -29,6 +29,7 @@ use C4::Koha;
 my $input        = new CGI;
 my $dbh          = C4::Context->dbh;
 my $error         = $input->param('error');
+my $authid  = $input->param('authid') || 0;
 my $nameany     = $input->param('nameany');
 my $authorany     = $input->param('authorany');
 my $authorcorp     = $input->param('authorcorp');
@@ -42,12 +43,12 @@ my $srchany       = $input->param('srchany');
 my $op            = $input->param('op')||'';
 my $page            = $input->param('current_page') || 1;
 $page = $input->param('goto_page') if $input->param('changepage_goto');
+my $controlnumber    = $input->param('controlnumber');
 
 my ( $template, $loggedinuser, $cookie ) = get_template_and_user({
-        template_name   => "cataloguing/z3950_auth_search.tmpl",
+        template_name   => "cataloguing/z3950_auth_search.tt",
         query           => $input,
         type            => "intranet",
-        authnotrequired => 1,
         flagsrequired   => { catalogue => 1 },
 });
 
@@ -62,10 +63,12 @@ $template->param(
     subject      => $subject,
     subjectsubdiv   => $subjectsubdiv,
     srchany      => $srchany,
+    authid => $authid,
+    controlnumber => $controlnumber,
 );
 
 if ( $op ne "do_search" ) {
-    my $sth = $dbh->prepare("SELECT id,host,name,checked FROM z3950servers WHERE recordtype = 'authority' ORDER BY rank, name");
+    my $sth = $dbh->prepare("SELECT id,host,servername,checked FROM z3950servers WHERE recordtype = 'authority' ORDER BY `rank`, servername");
     $sth->execute();
     my $serverloop = $sth->fetchall_arrayref( {} );
     $template->param(
@@ -76,7 +79,7 @@ if ( $op ne "do_search" ) {
     exit;
 }
 
-my @id = $input->param('id');
+my @id = $input->multi_param('id');
 if ( @id==0 ) {
         # empty server list -> report and exit
         $template->param( emptyserverlist => 1 );
@@ -85,7 +88,6 @@ if ( @id==0 ) {
 }
 
 my $pars= {
-        random => $input->param('random') || rand(1000000000),
         page => $page,
         id => \@id,
         nameany => $nameany,
@@ -98,6 +100,8 @@ my $pars= {
         subject => $subject,
         subjectsubdiv => $subjectsubdiv,
         srchany => $srchany,
+        authid => $authid,
+        controlnumber => $controlnumber,
 };
 Z3950SearchAuth($pars, $template);
 output_html_with_http_headers $input, $cookie, $template->output;