Bug 19725: OAI-PMH - Use biblio_metadata.timestamp
[koha.git] / acqui / z3950_search.pl
blob59f9f3637c7775a1de25a4a8d0e3eb5b355e37e6
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;
32 use Koha::Acquisition::Booksellers;
33 use Koha::BiblioFrameworks;
35 my $input = new CGI;
36 my $biblionumber = $input->param('biblionumber')||0;
37 my $frameworkcode = $input->param('frameworkcode') || q{};
38 my $title = $input->param('title');
39 my $author = $input->param('author');
40 my $isbn = $input->param('isbn');
41 my $issn = $input->param('issn');
42 my $lccn = $input->param('lccn');
43 my $lccall = $input->param('lccall');
44 my $subject = $input->param('subject');
45 my $dewey = $input->param('dewey');
46 my $controlnumber = $input->param('controlnumber');
47 my $op = $input->param('op')||'';
48 my $booksellerid = $input->param('booksellerid');
49 my $basketno = $input->param('basketno');
50 my $page = $input->param('current_page') || 1;
51 $page = $input->param('goto_page') if $input->param('changepage_goto');
53 # get framework list
54 my $frameworks = Koha::BiblioFrameworks->search({}, { order_by => ['frameworktext'] });
56 my $vendor = Koha::Acquisition::Booksellers->find( $booksellerid );
58 my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
60 template_name => "acqui/z3950_search.tt",
61 query => $input,
62 type => "intranet",
63 flagsrequired => { acquisition => 'order_manage' },
66 $template->param(
67 frameworkcode => $frameworkcode,
68 frameworks => $frameworks,
69 booksellerid => $booksellerid,
70 basketno => $basketno,
71 name => $vendor->name,
72 isbn => $isbn,
73 issn => $issn,
74 lccn => $lccn,
75 lccall => $lccall,
76 title => $title,
77 author => $author,
78 controlnumber=> $controlnumber,
79 biblionumber => $biblionumber,
80 dewey => $dewey,
81 subject => $subject,
84 if ( $op ne "do_search" ) {
85 my $schema = Koha::Database->new()->schema();
86 my $rs = $schema->resultset('Z3950server')->search(
88 recordtype => 'biblio',
89 servertype => ['zed', 'sru'],
91 { result_class => 'DBIx::Class::ResultClass::HashRefInflator',
92 order_by => ['rank', 'servername'],
95 $template->param(
96 serverloop => [ $rs->all ],
97 opsearch => "search",
99 output_html_with_http_headers $input, $cookie, $template->output;
100 exit;
103 my @id = $input->multi_param('id');
104 if (@id==0) {
105 $template->param( emptyserverlist => 1 );
106 output_html_with_http_headers $input, $cookie, $template->output;
107 exit;
110 my $pars= {
111 biblionumber => $biblionumber,
112 page => $page,
113 id => \@id,
114 isbn => $isbn,
115 issn => $issn,
116 title => $title,
117 author => $author,
118 dewey => $dewey,
119 subject => $subject,
120 lccall => $lccall,
121 controlnumber => $controlnumber,
122 stdid => 0,
123 srchany => 0,
125 Z3950Search($pars, $template);
126 output_html_with_http_headers $input, $cookie, $template->output;