Bug 6149: DBRev 3.17.00.019
[koha.git] / cataloguing / z3950_auth_search.pl
blob806b387179373927cfe3ab06c7897d9fab58c587
1 #!/usr/bin/perl
3 # This file is part of Koha.
5 # Copyright 2013 Prosentient Systems
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.
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.
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>.
19 use strict;
20 use warnings;
21 use CGI qw / -utf8 /;
23 use C4::Auth;
24 use C4::Output;
25 use C4::Context;
26 use C4::Breeding;
27 use C4::Koha;
29 my $input = new CGI;
30 my $dbh = C4::Context->dbh;
31 my $error = $input->param('error');
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 $page = $input->param('goto_page') if $input->param('changepage_goto');
46 my ( $template, $loggedinuser, $cookie ) = get_template_and_user({
47 template_name => "cataloguing/z3950_auth_search.tt",
48 query => $input,
49 type => "intranet",
50 flagsrequired => { catalogue => 1 },
51 });
53 $template->param(
54 nameany => $nameany,
55 authorany => $authorany,
56 authorcorp => $authorcorp,
57 authorpersonal => $authorpersonal,
58 authormeetingcon => $authormeetingcon,
59 title => $title,
60 uniformtitle => $uniformtitle,
61 subject => $subject,
62 subjectsubdiv => $subjectsubdiv,
63 srchany => $srchany,
66 if ( $op ne "do_search" ) {
67 my $sth = $dbh->prepare("SELECT id,host,servername,checked FROM z3950servers WHERE recordtype = 'authority' AND servertype='zed' ORDER BY rank, servername");
68 $sth->execute();
69 my $serverloop = $sth->fetchall_arrayref( {} );
70 $template->param(
71 serverloop => $serverloop,
72 opsearch => "search",
74 output_html_with_http_headers $input, $cookie, $template->output;
75 exit;
78 my @id = $input->param('id');
79 if ( @id==0 ) {
80 # empty server list -> report and exit
81 $template->param( emptyserverlist => 1 );
82 output_html_with_http_headers $input, $cookie, $template->output;
83 exit;
86 my $pars= {
87 random => $input->param('random') || rand(1000000000),
88 page => $page,
89 id => \@id,
90 nameany => $nameany,
91 authorany => $authorany,
92 authorcorp => $authorcorp,
93 authorpersonal => $authorpersonal,
94 authormeetingcon => $authormeetingcon,
95 title => $title,
96 uniformtitle => $uniformtitle,
97 subject => $subject,
98 subjectsubdiv => $subjectsubdiv,
99 srchany => $srchany,
101 Z3950SearchAuth($pars, $template);
102 output_html_with_http_headers $input, $cookie, $template->output;