2 # WARNING: 4-character tab stops here
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
29 use C4::Interface::CGI::Output;
32 use C4::Koha; # XXX subfield_is_koha_internal_p
35 # Creates a scrolling list with the associated default value.
36 # Using more than one scrolling list in a CGI assigns the same default value to all the
37 # scrolling lists on the page !?!? That's why this function was written.
40 my $type=$query->param('type');
41 my $op = $query->param('op');
42 my $dbh = C4::Context->dbh;
44 my $startfrom=$query->param('startfrom');
45 $startfrom=0 if(!defined $startfrom);
46 my ($template, $loggedinuser, $cookie);
49 if ($op eq "do_search") {
50 my @kohafield = $query->param('kohafield');
51 my @and_or = $query->param('and_or');
52 my @relation = $query->param('relation');
53 my @value = $query->param('value');
54 my $order=$query->param('order');
55 $resultsperpage= $query->param('resultsperpage');
56 $resultsperpage = 9 if(!defined $resultsperpage);
57 # builds tag and subfield arrays
59 my ($total,@results) = ZEBRAsearch_kohafields(\@kohafield,\@value,\@relation,$order,\@and_or,1,"",$startfrom,$resultsperpage,"intranet");
61 ($template, $loggedinuser, $cookie)
62 = get_template_and_user({template_name => "serials/result.tmpl",
66 flagsrequired => {borrowers => 1},
67 flagsrequired => {catalogue => 1},
71 # multi page display gestion
73 my $displayprev=$startfrom;
74 if(($total - (($startfrom+1)*($resultsperpage))) > 0 ){
81 for(my $i = 0 ; $i <= $#value ; $i++)
83 push @field_data, { term => "kohafield", val=>$kohafield[$i] };
84 push @field_data, { term => "and_or", val=>$and_or[$i] };
85 push @field_data, { term => "relation", val=>$relation[$i] };
86 push @field_data, { term => "value", val=>$value[$i] };
91 if ($total>$resultsperpage)
93 for (my $i=1; $i<$total/$resultsperpage+1; $i++)
98 ($startfrom==($i-1)) && ($highlight=1);
99 push @numbers, { number => $i,
100 highlight => $highlight ,
101 searchdata=> \@field_data,
102 startfrom => ($i-1)};
107 my $from = $startfrom*$resultsperpage+1;
110 if($total < (($startfrom+1)*$resultsperpage))
114 $to = (($startfrom+1)*$resultsperpage);
116 $template->param(result => \@results,
117 startfrom=> $startfrom,
118 displaynext=> $displaynext,
119 displayprev=> $displayprev,
120 resultsperpage => $resultsperpage,
121 startfromnext => $startfrom+1,
122 startfromprev => $startfrom-1,
123 searchdata=>\@field_data,
130 ($template, $loggedinuser, $cookie)
131 = get_template_and_user({template_name => "serials/subscription-bib-search.tmpl",
134 authnotrequired => 0,
135 flagsrequired => {catalogue => 1},
138 my $sth=$dbh->prepare("Select itemtype,description from itemtypes order by description");
144 while (my ($value,$lib) = $sth->fetchrow_array) {
145 push @itemtype, $value;
146 $itemtypes{$value}=$lib;
149 my $CGIitemtype=CGI::scrolling_list( -name => 'value',
150 -values => \@itemtype,
151 -labels => \%itemtypes,
158 CGIitemtype => $CGIitemtype,
164 $template->param(intranetcolorstylesheet => C4::Context->preference("intranetcolorstylesheet"),
165 intranetstylesheet => C4::Context->preference("intranetstylesheet"),
166 IntranetNav => C4::Context->preference("IntranetNav"),
168 output_html_with_http_headers $query, $cookie, $template->output;