Bug 28787: (QA follow-up) Remove unused variable
[koha.git] / cataloguing / z3950_auth_search.pl
1 #!/usr/bin/perl
2
3 # This file is part of Koha.
4 #
5 # Copyright 2013 Prosentient Systems
6 #
7 # Koha is free software; you can redistribute it and/or modify it under the
8 # terms of the GNU General Public License as published by the Free Software
9 # Foundation; either version 3 of the License, or (at your option) any later
10 # version.
11 #
12 # Koha is distributed in the hope that it will be useful, but WITHOUT ANY
13 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
14 # A PARTICULAR PURPOSE. See the GNU General Public License for more details.
15 #
16 # You should have received a copy of the GNU General Public License along
17 # with Koha; if not, see <http://www.gnu.org/licenses>.
18
19 use Modern::Perl;
20
21 use CGI qw / -utf8 /;
22
23 use C4::Auth qw( get_template_and_user );
24 use C4::Output qw( output_html_with_http_headers );
25 use C4::Context;
26 use C4::Breeding qw( Z3950Search Z3950SearchAuth );
27
28 my $input        = CGI->new;
29 my $dbh          = C4::Context->dbh;
30 my $error         = $input->param('error');
31 my $authid  = $input->param('authid') || 0;
32 my $nameany     = $input->param('nameany');
33 my $authorany     = $input->param('authorany');
34 my $authorcorp     = $input->param('authorcorp');
35 my $authorpersonal     = $input->param('authorpersonal');
36 my $authormeetingcon     = $input->param('authormeetingcon');
37 my $title         = $input->param('title');
38 my $uniformtitle         = $input->param('uniformtitle');
39 my $subject       = $input->param('subject');
40 my $subjectsubdiv       = $input->param('subjectsubdiv');
41 my $srchany       = $input->param('srchany');
42 my $op            = $input->param('op')||'';
43 my $page            = $input->param('current_page') || 1;
44 my $index =$input->param('index');
45 $page = $input->param('goto_page') if $input->param('changepage_goto');
46 my $controlnumber    = $input->param('controlnumber');
47
48 my ( $template, $loggedinuser, $cookie ) = get_template_and_user({
49         template_name   => "cataloguing/z3950_auth_search.tt",
50         query           => $input,
51         type            => "intranet",
52         flagsrequired   => { catalogue => 1 },
53 });
54
55 $template->param(
56     nameany    => $nameany,
57     authorany    => $authorany,
58     authorcorp    => $authorcorp,
59     authorpersonal    => $authorpersonal,
60     authormeetingcon    => $authormeetingcon,
61     title        => $title,
62     uniformtitle      => $uniformtitle,
63     subject      => $subject,
64     subjectsubdiv   => $subjectsubdiv,
65     srchany      => $srchany,
66     authid => $authid,
67     controlnumber => $controlnumber,
68     index => $index,
69 );
70
71 if ( $op ne "do_search" ) {
72     my $sth = $dbh->prepare("SELECT id,host,servername,checked FROM z3950servers WHERE recordtype = 'authority' ORDER BY `rank`, servername");
73     $sth->execute();
74     my $serverloop = $sth->fetchall_arrayref( {} );
75     $template->param(
76         serverloop   => $serverloop,
77         opsearch     => "search",
78         index        => $index,
79     );
80     output_html_with_http_headers $input, $cookie, $template->output;
81     exit;
82 }
83
84 my @id = $input->multi_param('id');
85 if ( @id==0 ) {
86         # empty server list -> report and exit
87         $template->param( emptyserverlist => 1 );
88         output_html_with_http_headers $input, $cookie, $template->output;
89         exit;
90 }
91
92 my $pars= {
93         page => $page,
94         id => \@id,
95         nameany => $nameany,
96         authorany => $authorany,
97         authorcorp => $authorcorp,
98         authorpersonal => $authorpersonal,
99         authormeetingcon => $authormeetingcon,
100         title => $title,
101         uniformtitle => $uniformtitle,
102         subject => $subject,
103         subjectsubdiv => $subjectsubdiv,
104         srchany => $srchany,
105         authid => $authid,
106         controlnumber => $controlnumber,
107 };
108 Z3950SearchAuth($pars, $template);
109 output_html_with_http_headers $input, $cookie, $template->output;