Bug 23794: (RM follow-up) Make DB update consistent
[koha.git] / cataloguing / z3950_search.pl
blobe4fce4559743cb099d5374a7efc243b3084d1711
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
9 # under the terms of the GNU General Public License as published by
10 # the Free Software Foundation; either version 3 of the License, or
11 # (at your option) any later version.
13 # Koha is distributed in the hope that it will be useful, but
14 # WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 # GNU General Public License for more details.
18 # You should have received a copy of the GNU General Public License
19 # along with Koha; if not, see <http://www.gnu.org/licenses>.
21 use Modern::Perl;
22 use CGI qw ( -utf8 );
24 use C4::Auth;
25 use C4::Output;
26 use C4::Context;
27 use C4::Breeding;
28 use C4::Koha;
30 my $input = new CGI;
31 my $error = $input->param('error');
32 my $biblionumber = $input->param('biblionumber') || 0;
33 my $frameworkcode = $input->param('frameworkcode');
34 my $title = $input->param('title');
35 my $author = $input->param('author');
36 my $isbn = $input->param('isbn');
37 my $issn = $input->param('issn');
38 my $lccn = $input->param('lccn');
39 my $lccall = $input->param('lccall');
40 my $subject = $input->param('subject');
41 my $dewey = $input->param('dewey');
42 my $controlnumber = $input->param('controlnumber');
43 my $stdid = $input->param('stdid');
44 my $srchany = $input->param('srchany');
45 my $publicationyear = $input->param('publicationyear');
46 my $op = $input->param('op')||'';
48 my $page = $input->param('current_page') || 1;
49 $page = $input->param('goto_page') if $input->param('changepage_goto');
51 my ( $template, $loggedinuser, $cookie ) = get_template_and_user({
52 template_name => "cataloguing/z3950_search.tt",
53 query => $input,
54 type => "intranet",
55 flagsrequired => { catalogue => 1 },
56 });
58 $template->param(
59 frameworkcode => $frameworkcode,
60 isbn => $isbn,
61 issn => $issn,
62 lccn => $lccn,
63 lccall => $lccall,
64 title => $title,
65 author => $author,
66 controlnumber=> $controlnumber,
67 stdid => $stdid,
68 srchany => $srchany,
69 biblionumber => $biblionumber,
70 dewey => $dewey,
71 subject => $subject,
72 publicationyear => $publicationyear,
75 if ( $op ne "do_search" ) {
76 my $schema = Koha::Database->new()->schema();
77 my $rs = $schema->resultset('Z3950server')->search(
79 recordtype => 'biblio',
80 servertype => ['zed', 'sru'],
82 { result_class => 'DBIx::Class::ResultClass::HashRefInflator',
83 order_by => ['rank', 'servername'],
86 $template->param(
87 serverloop => [ $rs->all ],
88 opsearch => "search",
90 output_html_with_http_headers $input, $cookie, $template->output;
91 exit;
94 my @id = $input->multi_param('id');
95 if ( @id==0 ) {
96 # empty server list -> report and exit
97 $template->param( emptyserverlist => 1 );
98 output_html_with_http_headers $input, $cookie, $template->output;
99 exit;
102 my $pars= {
103 biblionumber => $biblionumber,
104 page => $page,
105 id => \@id,
106 isbn => $isbn,
107 issn => $issn,
108 title => $title,
109 author => $author,
110 dewey => $dewey,
111 subject => $subject,
112 lccall => $lccall,
113 controlnumber => $controlnumber,
114 stdid => $stdid,
115 srchany => $srchany,
116 publicationyear => $publicationyear,
118 Z3950Search($pars, $template);
119 output_html_with_http_headers $input, $cookie, $template->output;