Bumping version number for release
[koha.git] / acqui / z3950_search.pl
blobf33210a195650bd855b3a9ea7b6fa6e7d0dfc305
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
5 # Copyright 2010 Catalyst IT
7 # This file is part of Koha.
9 # Koha is free software; you can redistribute it and/or modify it
10 # under the terms of the GNU General Public License as published by
11 # the Free Software Foundation; either version 3 of the License, or
12 # (at your option) any later version.
14 # Koha is distributed in the hope that it will be useful, but
15 # WITHOUT ANY WARRANTY; without even the implied warranty of
16 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 # GNU General Public License for more details.
19 # You should have received a copy of the GNU General Public License
20 # along with Koha; if not, see <http://www.gnu.org/licenses>.
22 use warnings;
23 use strict;
24 use CGI qw/-utf8/;
26 use C4::Auth;
27 use C4::Output;
28 use C4::Context;
29 use C4::Breeding;
30 use C4::Koha;
31 use C4::Bookseller qw/ GetBookSellerFromId /;
33 my $input = new CGI;
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 $op = $input->param('op')||'';
46 my $booksellerid = $input->param('booksellerid');
47 my $basketno = $input->param('basketno');
48 my $page = $input->param('current_page') || 1;
49 $page = $input->param('goto_page') if $input->param('changepage_goto');
51 # get framework list
52 my $frameworks = getframeworks;
53 my @frameworkcodeloop;
54 foreach my $thisframeworkcode ( keys %$frameworks ) {
55 my %row = (
56 value => $thisframeworkcode,
57 frameworktext => $frameworks->{$thisframeworkcode}->{'frameworktext'},
59 if ( $row{'value'} eq $frameworkcode){
60 $row{'active'} = 'true';
62 push @frameworkcodeloop, \%row;
65 my $vendor = GetBookSellerFromId($booksellerid);
67 my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
69 template_name => "acqui/z3950_search.tt",
70 query => $input,
71 type => "intranet",
72 flagsrequired => { acquisition => 'order_manage' },
75 $template->param(
76 frameworkcode => $frameworkcode,
77 frameworkcodeloop => \@frameworkcodeloop,
78 booksellerid => $booksellerid,
79 basketno => $basketno,
80 name => $vendor->{'name'},
81 isbn => $isbn,
82 issn => $issn,
83 lccn => $lccn,
84 lccall => $lccall,
85 title => $title,
86 author => $author,
87 controlnumber=> $controlnumber,
88 biblionumber => $biblionumber,
89 dewey => $dewey,
90 subject => $subject,
93 if ( $op ne "do_search" ) {
94 my $schema = Koha::Database->new()->schema();
95 my $rs = $schema->resultset('Z3950server')->search(
97 recordtype => 'biblio',
98 servertype => ['zed', 'sru'],
100 { result_class => 'DBIx::Class::ResultClass::HashRefInflator',
101 order_by => ['rank', 'servername'],
104 $template->param(
105 serverloop => [ $rs->all ],
106 opsearch => "search",
108 output_html_with_http_headers $input, $cookie, $template->output;
109 exit;
112 my @id = $input->param('id');
113 if (@id==0) {
114 $template->param( emptyserverlist => 1 );
115 output_html_with_http_headers $input, $cookie, $template->output;
116 exit;
119 my $pars= {
120 biblionumber => $biblionumber,
121 page => $page,
122 id => \@id,
123 isbn => $isbn,
124 issn => $issn,
125 title => $title,
126 author => $author,
127 dewey => $dewey,
128 subject => $subject,
129 lccall => $lccall,
130 controlnumber => $controlnumber,
131 stdid => 0,
132 srchany => 0,
134 Z3950Search($pars, $template);
135 output_html_with_http_headers $input, $cookie, $template->output;