Bug 10480: Use the framework plugin object in cataloguing
[koha.git] / acqui / z3950_search.pl
blobe30901a368d583a58b8318120b1b0a0fb7c825d2
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 under the
10 # terms of the GNU General Public License as published by the Free Software
11 # Foundation; either version 2 of the License, or (at your option) any later
12 # version.
14 # Koha is distributed in the hope that it will be useful, but WITHOUT ANY
15 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
16 # A PARTICULAR PURPOSE. See the GNU General Public License for more details.
18 # You should have received a copy of the GNU General Public License along
19 # with Koha; if not, write to the Free Software Foundation, Inc.,
20 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
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;
32 use Koha::Acquisition::Bookseller;
34 my $input = new CGI;
35 my $biblionumber = $input->param('biblionumber')||0;
36 my $frameworkcode = $input->param('frameworkcode')||'';
37 my $title = $input->param('title');
38 my $author = $input->param('author');
39 my $isbn = $input->param('isbn');
40 my $issn = $input->param('issn');
41 my $lccn = $input->param('lccn');
42 my $lccall = $input->param('lccall');
43 my $subject = $input->param('subject');
44 my $dewey = $input->param('dewey');
45 my $controlnumber = $input->param('controlnumber');
46 my $op = $input->param('op')||'';
47 my $booksellerid = $input->param('booksellerid');
48 my $basketno = $input->param('basketno');
49 my $page = $input->param('current_page') || 1;
50 $page = $input->param('goto_page') if $input->param('changepage_goto');
52 # get framework list
53 my $frameworks = getframeworks;
54 my @frameworkcodeloop;
55 foreach my $thisframeworkcode ( keys %$frameworks ) {
56 my %row = (
57 value => $thisframeworkcode,
58 frameworktext => $frameworks->{$thisframeworkcode}->{'frameworktext'},
60 if ( $row{'value'} eq $frameworkcode){
61 $row{'active'} = 'true';
63 push @frameworkcodeloop, \%row;
66 my $vendor = Koha::Acquisition::Bookseller->fetch({ id => $booksellerid });
68 my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
70 template_name => "acqui/z3950_search.tt",
71 query => $input,
72 type => "intranet",
73 flagsrequired => { acquisition => 'order_manage' },
76 $template->param(
77 frameworkcode => $frameworkcode,
78 frameworkcodeloop => \@frameworkcodeloop,
79 booksellerid => $booksellerid,
80 basketno => $basketno,
81 name => $vendor->{'name'},
82 isbn => $isbn,
83 issn => $issn,
84 lccn => $lccn,
85 lccall => $lccall,
86 title => $title,
87 author => $author,
88 controlnumber=> $controlnumber,
89 biblionumber => $biblionumber,
90 dewey => $dewey,
91 subject => $subject,
94 if ( $op ne "do_search" ) {
95 my $schema = Koha::Database->new()->schema();
96 my $rs = $schema->resultset('Z3950server')->search(
98 recordtype => 'biblio',
99 servertype => ['zed', 'sru'],
101 { result_class => 'DBIx::Class::ResultClass::HashRefInflator' },
103 $template->param(
104 serverloop => [ $rs->all ],
105 opsearch => "search",
107 output_html_with_http_headers $input, $cookie, $template->output;
108 exit;
111 my @id = $input->param('id');
112 if (@id==0) {
113 $template->param( emptyserverlist => 1 );
114 output_html_with_http_headers $input, $cookie, $template->output;
115 exit;
118 my $pars= {
119 biblionumber => $biblionumber,
120 page => $page,
121 id => \@id,
122 isbn => $isbn,
123 issn => $issn,
124 title => $title,
125 author => $author,
126 dewey => $dewey,
127 subject => $subject,
128 lccall => $lccall,
129 controlnumber => $controlnumber,
130 stdid => 0,
131 srchany => 0,
133 Z3950Search($pars, $template);
134 output_html_with_http_headers $input, $cookie, $template->output;