3 # Copyright 2000-2002 Katipo Communications
5 # This file is part of Koha.
7 # Koha is free software; you can redistribute it and/or modify it under the
8 # terms of the GNU General Public License as published by the Free Software
9 # Foundation; either version 2 of the License, or (at your option) any later
12 # Koha is distributed in the hope that it will be useful, but WITHOUT ANY
13 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
14 # A PARTICULAR PURPOSE. See the GNU General Public License for more details.
16 # You should have received a copy of the GNU General Public License along with
17 # Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
18 # Suite 330, Boston, MA 02111-1307 USA
24 use C4::Interface::CGI::Output;
27 use C4::Koha; # XXX subfield_is_koha_internal_p
31 use MARC::File::USMARC;
33 use vars qw( $tagslib );
34 use vars qw( $is_a_modif );
38 my $dbh = C4::Context->dbh;
39 my $error = $input->param('error');
40 my $bibid=$input->param('bibid');
41 my $title = $input->param('title');
42 my $author = $input->param('author');
43 my $isbn = $input->param('isbn');
44 my $issn = $input->param('issn');
45 my $random = $input->param('random');
52 warn "search.pl : $bibid / $title / $author / $isbn";
54 $record = MARCgetbiblio($dbh,$bibid);
55 $oldbiblio = MARCmarc2koha($dbh,$record);
58 unless ($random) { # if random is a parameter => we're just waiting for the search to end, it's a refresh.
61 warn "ADD ISBN $isbn";
62 $random =rand(1000000000);
63 $errmsg = addz3950queue($isbn, "isbn", $random, 'CHECKED');
65 warn "ADD AUTHOR $author";
66 $random =rand(1000000000);
67 $errmsg = addz3950queue($author, "author", $random, 'CHECKED');
69 warn "ADD TITLE : $title";
70 $random =rand(1000000000);
71 $errmsg = addz3950queue($title, "title", $random, 'CHECKED');
74 my ($template, $loggedinuser, $cookie)
75 = get_template_and_user({template_name => "z3950/searchresult.tmpl",
79 flagsrequired => {catalogue => 1},
83 # fill with books in breeding farm
84 ($count, @results) = breedingsearch($title,$isbn,$random);
85 my $numberpending= &checkz3950searchdone($random);
86 my @breeding_loop = ();
87 for (my $i=0; $i <= $#results; $i++) {
94 $row_data{toggle} = $toggle;
95 $row_data{id} = $results[$i]->{'id'};
96 $row_data{isbn} = $results[$i]->{'isbn'};
97 $row_data{file} = $results[$i]->{'file'};
98 $row_data{title} = $results[$i]->{'title'};
99 $row_data{author} = $results[$i]->{'author'};
100 push (@breeding_loop, \%row_data);
103 $template->param(isbn => $isbn,
106 breeding_loop => \@breeding_loop,
107 refresh => ($numberpending eq 0 ? 0 : "search.pl?bibid=$bibid&random=$random"),
108 numberpending => $numberpending,
109 oldbiblionumber => $oldbiblio->{'biblionumber'},
112 print $input->header(
113 -type => guesstype($template->output),