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
33 #whether it is called from the opac of the intranet
34 my $type=$input->param('type');
48 #build hash of users input
49 my $title=$input->param('search');
50 $search{'title'}=$title;
51 my $keyword=$input->param('d');
52 $search{'keyword'}=$keyword;
53 my $author=$input->param('author');
54 $search{'author'}=$author;
57 my $offset=$input->param('offset');
61 my $num=$input->param('num');
65 my $id=$input->param('id');
66 my $basket=$input->param('basket');
67 my $sub=$input->param('sub');
73 my ($count,@booksellers)=bookseller($id);
76 print startmenu('acquisitions');
77 print mkheadr(1,"Shopping Basket For: $booksellers[0]->{'name'}");
79 if ($donation ne 'yes'){
80 print "<a href=newbiblio.pl?id=$id&basket=$basket&sub=$sub>";
82 print "<a href=newdonation.pl?id=$id&basket=$basket&sub=$sub>";
85 <img src=/images/add-biblio.gif width=187 heigth=42 border=0 align=right alt="Add New Biblio"></a>
86 <a href=basket.pl?basket=$basket><img src=/images/view-basket.gif width=187 heigth=42 border=0 align=right alt="View Basket"></a>
88 <FORM ACTION="/cgi-bin/koha/acqui/newbasket2.pl">
89 <input type=hidden name=id value="$id">
90 <input type=hidden name=basket value="$basket">
91 <b>New Search: </b><INPUT TYPE="text" SIZE="25" NAME="search"></form>
102 ($count,@results)=KeywordSearch(undef,'intra',\%search,$num,$offset);
103 } elsif ($search{'front'} ne '') {
104 ($count,@results)=FrontSearch(undef,'intra',\%search,$num,$offset);
106 ($count,@results)=CatSearch(undef,'loose',\%search,$num,$offset);
110 print "You searched on ";
111 while ( my ($key, $value) = each %search) {
114 print bold("$key $value,");
117 print " $count results found";
118 my $offset2=$num+$offset;
119 my $dispnum=$offset+1;
120 print "<br> Results $dispnum to $offset2 displayed";
124 print mktablerow(6,$main,'<b>TITLE</b>','<b>AUTHOR</b>',bold('©'),'<b>COUNT</b>',bold('LOCATION'),'','/images/background-mem.gif');
128 if ($keyword ne '' && $offset > 0){
129 $count2=$count-$offset;
137 while ($i < $count2){
138 # print $results[$i]."\n";
139 # my @stuff=split('\t',$results[$i]);
140 my $result=$results[$i];
141 $result->{'title'}=~ s/\`/\\\'/g;
142 my $title2=$result->{'title'};
143 my $author2=$result->{'author'};
144 my $copyright=$result->{'copyrightdate'};
145 $author2=~ s/ /%20/g;
147 $title2=~ s/\#/\&\#x23;/g;
148 $title2=~ s/\"/\"\;/g;
151 if ($donation eq 'yes'){
152 $result->{'title'}=mklink("/cgi-bin/koha/acqui/newdonation.pl?author=$author2©right=$copyright&id=$id&basket=$basket&biblio=$result->{'biblionumber'}&title=$title2",$result->{'title'});
154 $result->{'title'}=mklink("/cgi-bin/koha/acqui/newbiblio.pl?sub=$sub&author=$author2©right=$copyright&id=$id&basket=$basket&biblio=$result->{'biblionumber'}&title=$title2",$result->{'title'});
156 my $word=$result->{'author'};
157 $word=~ s/([a-z]) +([a-z])/$1%20$2/ig;
160 $word=~ s/\,/\,%20/g;
162 my $url="/cgi-bin/koha/search.pl?author=$word&type=$type";
163 $result->{'author'}=mklink($url,$result->{'author'});
164 my ($count,$lcount,$nacount,$fcount,$scount,$lostcount,$mending,$transit)=C4::Search::itemcount($env,$result->{'biblionumber'},$type);
167 $location=$location."On Loan";
169 $location=$location." ($nacount)";
174 $location=$location."Levin";
176 $location=$location." ($lcount)";
181 $location=$location."Foxton";
183 $location=$location." ($fcount)";
188 $location=$location."Shannon";
190 $location=$location." ($scount)";
195 $location=$location."Lost";
197 $location=$location." ($lostcount)";
202 $location=$location."Mending";
204 $location=$location." ($mending)";
209 $location=$location."In Transiit";
211 $location=$location." ($transit)";
217 print mktablerow(6,$secondary,$result->{'title'},$result->{'author'},$result->{'copyrightdate'},$itemcount,$location);
220 print mktablerow(6,'white',$result->{'title'},$result->{'author'},$result->{'copyrightdate'},$itemcount,$location);
225 $offset=$num+$offset;
227 print mktablerow(6,$main,' ',' ',' ',' ','','','/images/background-mem.gif');
230 if ($offset < $count){
231 my $search="num=$num&offset=$offset&type=$type&id=$id&basket=$basket&search=$title&author=$author";
232 my $stuff=mklink("/cgi-bin/koha/acqui/newbasket2.pl?$search",'Next');
237 print endmenu('acquisitions');