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
30 my $op = $query->param('op');
31 my $search = $query->param('titleorissn');
32 my $startfrom=$query->param('startfrom');
38 my $dbh = C4
::Context
->dbh;
39 my @marclist = $query->param('marclist');
40 my @and_or = $query->param('and_or');
41 my @excluding = $query->param('excluding');
42 my @operator = $query->param('operator');
43 my @value = $query->param('value');
45 my $resultsperpage= $query->param('resultsperpage');
46 $resultsperpage = 19 unless $resultsperpage;
49 my $sth = $dbh->prepare("select subscriptionid, biblionumber from subscription");
52 while (my $first_step = $sth->fetchrow_hashref)
54 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 ?)");
55 $sth2->execute($first_step->{'biblionumber'},$search, "%$search%");
57 @answear = $sth2->fetchrow_array;
58 $total = scalar @answear;
61 $first_step->{'serial'} = $answear[0];
62 push @finalsolution ,$first_step;
65 my ($template, $loggedinuser, $cookie)
66 = get_template_and_user
({template_name
=> "serials/receipt-search-result.tmpl",
70 flagsrequired
=> {serials
=> 1},
73 $template->param(subtable
=> \
@finalsolution, total
=> $total
77 my $displayprev=$startfrom;
78 if(($total - (($startfrom+1)*($resultsperpage))) > 0 ){
85 for(my $i = 0 ; $i <= $#marclist ; $i++)
87 push @field_data, { term
=> "marclist", val
=>$marclist[$i] };
88 push @field_data, { term
=> "and_or", val
=>$and_or[$i] };
89 push @field_data, { term
=> "excluding", val
=>$excluding[$i] };
90 push @field_data, { term
=> "operator", val
=>$operator[$i] };
91 push @field_data, { term
=> "value", val
=>$value[$i] };
96 if ($total>$resultsperpage)
98 for (my $i=1; $i<$total/$resultsperpage+1; $i++)
103 ($startfrom==($i-1)) && ($highlight=1);
104 push @numbers, { number
=> $i,
105 highlight
=> $highlight ,
106 searchdata
=> \
@field_data,
107 startfrom
=> ($i-1)};
112 my $from = $startfrom*$resultsperpage+1;
115 if($total < (($startfrom+1)*$resultsperpage))
119 $to = (($startfrom+1)*$resultsperpage);
121 $results = \
@finalsolution;
122 $template->param(result
=> $results) if $results;
124 startfrom
=> $startfrom,
125 displaynext
=> $displaynext,
126 displayprev
=> $displayprev,
127 resultsperpage
=> $resultsperpage,
128 startfromnext
=> $startfrom+1,
129 startfromprev
=> $startfrom-1,
130 searchdata
=>\
@field_data,
136 output_html_with_http_headers
$query, $cookie, $template->output;
140 my ($template, $loggedinuser, $cookie)
141 = get_template_and_user
({template_name
=> "serials/receipt.tmpl",
144 authnotrequired
=> 0,
145 flagsrequired
=> {serials
=> 1},
148 output_html_with_http_headers
$query, $cookie, $template->output;