Bug 10320 - Integrate OverDrive search into OPAC
[koha.git] / cataloguing / z3950_search.pl
blob8534190f6b24820380d1e1cda8b1f09046d04e73
1 #!/usr/bin/perl
3 # This is a completely new Z3950 clients search using async ZOOM -TG 02/11/06
4 # Copyright 2000-2002 Katipo Communications
6 # This file is part of Koha.
8 # Koha is free software; you can redistribute it and/or modify it under the
9 # terms of the GNU General Public License as published by the Free Software
10 # Foundation; either version 2 of the License, or (at your option) any later
11 # version.
13 # Koha is distributed in the hope that it will be useful, but WITHOUT ANY
14 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
15 # A PARTICULAR PURPOSE. See the GNU General Public License for more details.
17 # You should have received a copy of the GNU General Public License along
18 # with Koha; if not, write to the Free Software Foundation, Inc.,
19 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
21 use strict;
22 use warnings;
23 use CGI;
25 use C4::Auth;
26 use C4::Output;
27 use C4::Context;
28 use C4::Breeding;
29 use C4::Koha;
31 my $input = new CGI;
32 my $dbh = C4::Context->dbh;
33 my $error = $input->param('error');
34 my $biblionumber = $input->param('biblionumber') || 0;
35 my $frameworkcode = $input->param('frameworkcode');
36 my $title = $input->param('title');
37 my $author = $input->param('author');
38 my $isbn = $input->param('isbn');
39 my $issn = $input->param('issn');
40 my $lccn = $input->param('lccn');
41 my $lccall = $input->param('lccall');
42 my $subject = $input->param('subject');
43 my $dewey = $input->param('dewey');
44 my $controlnumber = $input->param('controlnumber');
45 my $stdid = $input->param('stdid');
46 my $srchany = $input->param('srchany');
47 my $op = $input->param('op')||'';
49 my $page = $input->param('current_page') || 1;
50 $page = $input->param('goto_page') if $input->param('changepage_goto');
52 my ( $template, $loggedinuser, $cookie ) = get_template_and_user({
53 template_name => "cataloguing/z3950_search.tmpl",
54 query => $input,
55 type => "intranet",
56 authnotrequired => 1,
57 flagsrequired => { catalogue => 1 },
58 });
60 $template->param(
61 frameworkcode => $frameworkcode,
62 isbn => $isbn,
63 issn => $issn,
64 lccn => $lccn,
65 lccall => $lccall,
66 title => $title,
67 author => $author,
68 controlnumber=> $controlnumber,
69 stdid => $stdid,
70 srchany => $srchany,
71 biblionumber => $biblionumber,
72 dewey => $dewey,
73 subject => $subject,
76 if ( $op ne "do_search" ) {
77 my $sth = $dbh->prepare("SELECT id,host,name,checked FROM z3950servers ORDER BY rank, name");
78 $sth->execute();
79 my $serverloop = $sth->fetchall_arrayref( {} );
80 $template->param(
81 serverloop => $serverloop,
82 opsearch => "search",
84 output_html_with_http_headers $input, $cookie, $template->output;
85 exit;
88 my @id = $input->param('id');
89 if ( @id==0 ) {
90 # empty server list -> report and exit
91 $template->param( emptyserverlist => 1 );
92 output_html_with_http_headers $input, $cookie, $template->output;
93 exit;
96 my $pars= {
97 biblionumber => $biblionumber,
98 page => $page,
99 id => \@id,
100 isbn => $isbn,
101 issn => $issn,
102 title => $title,
103 author => $author,
104 dewey => $dewey,
105 subject => $subject,
106 lccall => $lccall,
107 controlnumber => $controlnumber,
108 stdid => $stdid,
109 srchany => $srchany,
111 Z3950Search($pars, $template);
112 output_html_with_http_headers $input, $cookie, $template->output;