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 under the
9 # terms of the GNU General Public License as published by the Free Software
10 # Foundation; either version 2 of the License, or (at your option) any later
13 # Koha is distributed in the hope that it will be useful, but WITHOUT ANY
14 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
15 # A PARTICULAR PURPOSE. See the GNU General Public License for more details.
17 # You should have received a copy of the GNU General Public License along with
18 # Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
19 # Suite 330, Boston, MA 02111-1307 USA
28 use C4::Interface::CGI::Output;
32 my $isbn = $input->param('isbn');
33 my $title = $input->param('title');
34 my $offset = $input->param('offset');
35 my $num = $input->param('num');
36 my $showoffset = $offset + 1;
40 my ($template, $loggedinuser, $cookie)
41 = get_template_and_user({template_name => "acqui.simple/isbnsearch.tmpl",
45 flagsrequired => {catalogue => 1},
48 if (! $isbn && !$title) {
49 print $input->redirect('addbooks.pl');
51 # fill with books in ACTIVE DB (biblio)
56 if (! $num) { $num = 10 };
57 ($count, @results) = isbnsearch($isbn,$title);
59 if ($count < ($offset + $num)) {
62 $total = $offset + $num;
67 for (my $i = $offset; $i < $total; $i++) {
73 my %row_data; # get a fresh hash for the row data
74 $row_data{toggle} = $toggle;
75 $row_data{biblionumber} =$results[$i]->{'biblionumber'};
76 $row_data{title} = $results[$i]->{'title'};
77 $row_data{author} = $results[$i]->{'author'};
78 $row_data{copyrightdate} = $results[$i]->{'copyrightdate'};
79 push(@loop_data, \%row_data);
82 for (my $i = 0; ($i * $num) < $count; $i++) {
84 $row_data{newoffset} = $i * $num;
85 $row_data{shownumber} = $i + 1;
86 $row_data{num} = $num;
87 push (@loop_links,\%row_data);
89 # fill with books in breeding farm
90 ($count, @results) = breedingsearch($title,$isbn);
91 my @breeding_loop = ();
92 for (my $i=0; $i <= $#results; $i++) {
94 $row_data{id} = $results[$i]->{'id'};
95 $row_data{isbn} = $results[$i]->{'isbn'};
96 $row_data{file} = $results[$i]->{'file'};
97 $row_data{title} = $results[$i]->{'title'};
98 $row_data{author} = $results[$i]->{'author'};
99 push (@breeding_loop, \%row_data);
101 $template->param(isbn => $isbn,
102 showoffset => $showoffset,
106 breeding_loop => \@breeding_loop,
107 loop_links => \@loop_links);
109 print $input->header(
110 -type => guesstype($template->output),