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 if (! $isbn && !$title) {
41 print $input->redirect('addbooks.pl');
43 my ($template, $loggedinuser, $cookie)
44 = get_template_and_user({template_name => "acqui.simple/isbnsearch.tmpl",
48 flagsrequired => {catalogue => 1},
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);
81 $template->param(startfrom => $offset+1);
82 ($offset+$num<=$count) ? ($template->param(endat => $offset+$num)) : ($template->param(endat => $count));
83 $template->param(numrecords => $count);
84 my $nextstartfrom=($offset+$num<$count) ? ($offset+$num) : (-1);
85 my $prevstartfrom=($offset-$num>=0) ? ($offset-$num) : (-1);
86 $template->param(nextstartfrom => $nextstartfrom);
89 ($nextstartfrom==-1) ? ($displaynext=0) : ($displaynext=1);
90 ($prevstartfrom==-1) ? ($displayprev=0) : ($displayprev=1);
91 $template->param(displaynext => $displaynext);
92 $template->param(displayprev => $displayprev);
104 for (my $i=1; $i<$count/10+1; $i++) {
107 ($offset==($i-1)*10) && ($highlight=1);
108 push @numbers, { number => $i, highlight => $highlight , term => $term, value => $value, startfrom => ($i-1)*10};
112 # fill with books in breeding farm
113 ($count, @results) = breedingsearch($title,$isbn);
114 my @breeding_loop = ();
115 for (my $i=0; $i <= $#results; $i++) {
122 $row_data{toggle} = $toggle;
123 $row_data{id} = $results[$i]->{'id'};
124 $row_data{isbn} = $results[$i]->{'isbn'};
125 $row_data{file} = $results[$i]->{'file'};
126 $row_data{title} = $results[$i]->{'title'};
127 $row_data{author} = $results[$i]->{'author'};
128 push (@breeding_loop, \%row_data);
130 $template->param(isbn => $isbn,
132 showoffset => $showoffset,
136 breeding_loop => \@breeding_loop,
137 numbers => \@numbers,
142 print $input->header(
143 -type => guesstype($template->output),