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
31 my $op = $query->param('op');
32 my $search = $query->param('titleorissn');
33 my $startfrom=$query->param('startfrom');
39 my $dbh = C4::Context->dbh;
40 my @marclist = $query->param('marclist');
41 my @and_or = $query->param('and_or');
42 my @excluding = $query->param('excluding');
43 my @operator = $query->param('operator');
44 my @value = $query->param('value');
46 my $resultsperpage= $query->param('resultsperpage');
47 $resultsperpage = 19 unless $resultsperpage;
50 my $sth = $dbh->prepare("select subscriptionid, biblionumber from subscription");
53 while (my $first_step = $sth->fetchrow_hashref)
55 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 ?)");
56 $sth2->execute($first_step->{'biblionumber'},$search, "%$search%");
58 @answear = $sth2->fetchrow_array;
59 $total = scalar @answear;
62 $first_step->{'serial'} = $answear[0];
63 push @finalsolution ,$first_step;
66 my ($template, $loggedinuser, $cookie)
67 = get_template_and_user({template_name => "serials/receipt-search-result.tmpl",
71 flagsrequired => {serials => 1},
74 $template->param(subtable => \@finalsolution, total => $total
78 my $displayprev=$startfrom;
79 if(($total - (($startfrom+1)*($resultsperpage))) > 0 ){
86 for(my $i = 0 ; $i <= $#marclist ; $i++)
88 push @field_data, { term => "marclist", val=>$marclist[$i] };
89 push @field_data, { term => "and_or", val=>$and_or[$i] };
90 push @field_data, { term => "excluding", val=>$excluding[$i] };
91 push @field_data, { term => "operator", val=>$operator[$i] };
92 push @field_data, { term => "value", val=>$value[$i] };
97 if ($total>$resultsperpage)
99 for (my $i=1; $i<$total/$resultsperpage+1; $i++)
104 ($startfrom==($i-1)) && ($highlight=1);
105 push @numbers, { number => $i,
106 highlight => $highlight ,
107 searchdata=> \@field_data,
108 startfrom => ($i-1)};
113 my $from = $startfrom*$resultsperpage+1;
116 if($total < (($startfrom+1)*$resultsperpage))
120 $to = (($startfrom+1)*$resultsperpage);
122 $results = \@finalsolution;
123 $template->param(result => $results) if $results;
125 startfrom=> $startfrom,
126 displaynext=> $displaynext,
127 displayprev=> $displayprev,
128 resultsperpage => $resultsperpage,
129 startfromnext => $startfrom+1,
130 startfromprev => $startfrom-1,
131 searchdata=>\@field_data,
136 intranetcolorstylesheet => C4::Context->preference("intranetcolorstylesheet"),
137 intranetstylesheet => C4::Context->preference("intranetstylesheet"),
138 IntranetNav => C4::Context->preference("IntranetNav"),
140 output_html_with_http_headers $query, $cookie, $template->output;
144 my ($template, $loggedinuser, $cookie)
145 = get_template_and_user({template_name => "serials/receipt.tmpl",
148 authnotrequired => 0,
149 flagsrequired => {serials => 1},
152 output_html_with_http_headers $query, $cookie, $template->output;