2 #origninally script to provide intranet (librarian) advanced search facility
3 #now script to do searching for acquisitions
6 # Copyright 2000-2002 Katipo Communications
8 # This file is part of Koha.
10 # Koha is free software; you can redistribute it and/or modify it under the
11 # terms of the GNU General Public License as published by the Free Software
12 # Foundation; either version 2 of the License, or (at your option) any later
15 # Koha is distributed in the hope that it will be useful, but WITHOUT ANY
16 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
17 # A PARTICULAR PURPOSE. See the GNU General Public License for more details.
19 # You should have received a copy of the GNU General Public License along with
20 # Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
21 # Suite 330, Boston, MA 02111-1307 USA
34 #print $input->header;
36 #whether it is called from the opac of the intranet
37 my $type=$input->param('type');
51 #build hash of users input
52 my $title=$input->param('search');
53 $search{'title'}=$title;
54 my $keyword=$input->param('d');
55 $search{'keyword'}=$keyword;
56 my $author=$input->param('author');
57 $search{'author'}=$author;
60 my $offset=$input->param('offset');
64 my $num=$input->param('num');
68 my $id=$input->param('id');
69 my $basket=$input->param('basket');
70 my $sub=$input->param('sub');
76 my ($count,@booksellers)=bookseller($id);
78 my $template = gettemplate("acqui/newbasket2.tmpl");
80 #print startmenu('acquisitions');
82 my $testdonation = ($donation ne 'yes'); #tests if donation = true
85 ($count,@results)=KeywordSearch(undef,'intra',\%search,$num,$offset);
86 } elsif ($search{'front'} ne '') {
87 ($count,@results)=FrontSearch(undef,'intra',\%search,$num,$offset);
89 ($count,@results)=CatSearch(undef,'loose',\%search,$num,$offset);
94 while ( my ($key, $value) = each %search) {
98 $linesearch{key}=$key;
99 $linesearch{value}=$value;
100 push(@loopsearch,\%linesearch);
104 my $offset2=$num+$offset;
105 my $dispnum=$offset+1;
106 if ($offset2>$count) {
112 if ($keyword ne '' && $offset > 0){
113 $count2=$count-$offset;
124 while ($i < $count2){
125 # print $results[$i]."\n";
126 # my @stuff=split('\t',$results[$i]);
131 my $result=$results[$i];
132 $result->{'title'}=~ s/\`/\\\'/g;
133 my $title2=$result->{'title'};
134 my $author2=$result->{'author'};
135 $author2=~ s/ /%20/g;
137 $title2=~ s/\#/\&\#x23;/g;
138 $title2=~ s/\"/\"\;/g;
142 my $word=$result->{'author'};
143 $word=~ s/([a-z]) +([a-z])/$1%20$2/ig;
146 $word=~ s/\,/\,%20/g;
148 $lineres{word}=$word;
149 $lineres{type}=$type;
151 my ($count,$lcount,$nacount,$fcount,$scount,$lostcount,$mending,$transit)=C4::Search::itemcount($env,$result->{'biblionumber'},$type);
153 $location .= "On Loan";
155 $location .= " ($nacount)";
160 $location .= "Levin";
162 $location .= " ($lcount)";
167 $location .= "Foxton";
169 $location .= " ($fcount)";
174 $location .= "Shannon";
176 $location .= " ($scount)";
183 $location .= " ($lostcount)";
188 $location .= "Mending";
190 $location .= " ($mending)";
195 $location .= "In Transit";
197 $location .= " ($transit)";
208 $lineres{author2}=$author2;
209 $lineres{title2}=$title2;
210 $lineres{copyright}=$result->{'copyrightdate'};
212 $lineres{basket}=$basket;
214 $lineres{biblionumber}=$result->{biblionumber};
215 $lineres{title}=$result->{title};
216 $lineres{author}=$result->{author};
217 $lineres{coltab}=$coltab;
218 $lineres{itemcount}=$count;
219 $lineres{location}=$location;
220 push(@loopresult,\%lineres);
224 $offset=$num+$offset;
226 #print mktablerow(6,$main,' ',' ',' ',' ','','','/images/background-mem.gif');
229 $template->param( bookselname => $booksellers[0]->{'name'},
233 testdonation => $testdonation,
237 offsetover => ($offset < $count ),
245 loopsearch =>\@loopsearch,
246 loopresult =>\@loopresult);
249 print "Content-Type: text/html\n\n", $template->output;