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
26 use C4::Interface::CGI::Output;
32 my $op = $query->param('op');
33 my $search = $query->param('titleorissn');
34 my $startfrom=$query->param('startfrom');
40 my $dbh = C4::Context->dbh;
41 my @marclist = $query->param('marclist');
42 my @and_or = $query->param('and_or');
43 my @excluding = $query->param('excluding');
44 my @operator = $query->param('operator');
45 my @value = $query->param('value');
47 my $resultsperpage= $query->param('resultsperpage');
48 $resultsperpage = 19 unless $resultsperpage;
51 my $sth = $dbh->prepare("select subscriptionid, biblionumber from subscription");
54 while (my $first_step = $sth->fetchrow_hashref)
56 my $sth2 = $dbh->prepare("select b3.title from biblioitems b2, biblio b3 where b3.biblionumber = ? and b2.biblionumber = b3.biblionumber and (b2.issn = ? or b3.title like ?)");
57 $sth2->execute($first_step->{'biblionumber'},$search, "%$search%");
59 @answear = $sth2->fetchrow_array;
60 $total = scalar @answear;
63 $first_step->{'serial'} = $answear[0];
64 push @finalsolution ,$first_step;
67 my ($template, $loggedinuser, $cookie)
68 = get_template_and_user({template_name => "serials/receipt-search-result.tmpl",
72 flagsrequired => {serials => 1},
75 $template->param(subtable => \@finalsolution, total => $total
79 my $displayprev=$startfrom;
80 if(($total - (($startfrom+1)*($resultsperpage))) > 0 ){
87 for(my $i = 0 ; $i <= $#marclist ; $i++)
89 push @field_data, { term => "marclist", val=>$marclist[$i] };
90 push @field_data, { term => "and_or", val=>$and_or[$i] };
91 push @field_data, { term => "excluding", val=>$excluding[$i] };
92 push @field_data, { term => "operator", val=>$operator[$i] };
93 push @field_data, { term => "value", val=>$value[$i] };
98 if ($total>$resultsperpage)
100 for (my $i=1; $i<$total/$resultsperpage+1; $i++)
105 ($startfrom==($i-1)) && ($highlight=1);
106 push @numbers, { number => $i,
107 highlight => $highlight ,
108 searchdata=> \@field_data,
109 startfrom => ($i-1)};
114 my $from = $startfrom*$resultsperpage+1;
117 if($total < (($startfrom+1)*$resultsperpage))
121 $to = (($startfrom+1)*$resultsperpage);
123 $results = \@finalsolution;
124 $template->param(result => $results) if $results;
126 startfrom=> $startfrom,
127 displaynext=> $displaynext,
128 displayprev=> $displayprev,
129 resultsperpage => $resultsperpage,
130 startfromnext => $startfrom+1,
131 startfromprev => $startfrom-1,
132 searchdata=>\@field_data,
137 intranetcolorstylesheet => C4::Context->preference("intranetcolorstylesheet"),
138 intranetstylesheet => C4::Context->preference("intranetstylesheet"),
139 IntranetNav => C4::Context->preference("IntranetNav"),
141 output_html_with_http_headers $query, $cookie, $template->output;
145 my ($template, $loggedinuser, $cookie)
146 = get_template_and_user({template_name => "serials/receipt.tmpl",
149 authnotrequired => 0,
150 flagsrequired => {serials => 1},
153 output_html_with_http_headers $query, $cookie, $template->output;