Bug 30952: Fix position shift when hovering .linktools links
[koha-ffzg.git] / cataloguing / z3950_auth_search.pl
index 8951b5c..da93dac 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::Auth;
-use C4::Output;
+use C4::Auth qw( get_template_and_user );
+use C4::Output qw( output_html_with_http_headers );
 use C4::Context;
-use C4::Breeding;
-use C4::Koha;
+use C4::Breeding qw( Z3950Search Z3950SearchAuth );
 
-my $input        = new CGI;
+my $input        = CGI->new;
 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');
@@ -41,7 +41,9 @@ my $subjectsubdiv       = $input->param('subjectsubdiv');
 my $srchany       = $input->param('srchany');
 my $op            = $input->param('op')||'';
 my $page            = $input->param('current_page') || 1;
+my $index =$input->param('index');
 $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.tt",
@@ -61,21 +63,25 @@ $template->param(
     subject      => $subject,
     subjectsubdiv   => $subjectsubdiv,
     srchany      => $srchany,
+    authid => $authid,
+    controlnumber => $controlnumber,
+    index => $index,
 );
 
 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(
         serverloop   => $serverloop,
         opsearch     => "search",
+        index        => $index,
     );
     output_html_with_http_headers $input, $cookie, $template->output;
     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 );
@@ -84,7 +90,6 @@ if ( @id==0 ) {
 }
 
 my $pars= {
-        random => $input->param('random') || rand(1000000000),
         page => $page,
         id => \@id,
         nameany => $nameany,
@@ -97,6 +102,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;