2 #origninally script to provide intranet (librarian) advanced search facility
3 #now script to do searching for acquisitions
15 #whether it is called from the opac of the intranet
16 my $type=$input->param('type');
30 #build hash of users input
31 my $title=$input->param('search');
32 $search{'title'}=$title;
33 my $keyword=$input->param('d');
34 $search{'keyword'}=$keyword;
35 my $author=$input->param('author');
36 $search{'author'}=$author;
39 my $offset=$input->param('offset');
43 my $num=$input->param('num');
47 my $id=$input->param('id');
48 my $basket=$input->param('basket');
49 my $sub=$input->param('sub');
55 my ($count,@booksellers)=bookseller($id);
58 print startmenu('acquisitions');
59 print mkheadr(1,"Shopping Basket For: $booksellers[0]->{'name'}");
61 if ($donation ne 'yes'){
62 print "<a href=newbiblio.pl?id=$id&basket=$basket&sub=$sub>";
64 print "<a href=newdonation.pl?id=$id&basket=$basket&sub=$sub>";
67 <img src=/images/add-biblio.gif width=187 heigth=42 border=0 align=right alt="Add New Biblio"></a>
68 <a href=basket.pl?basket=$basket><img src=/images/view-basket.gif width=187 heigth=42 border=0 align=right alt="View Basket"></a>
70 <FORM ACTION="/cgi-bin/koha/acqui/newbasket2.pl">
71 <input type=hidden name=id value="$id">
72 <input type=hidden name=basket value="$basket">
73 <b>New Search: </b><INPUT TYPE="text" SIZE="25" NAME="search"></form>
84 ($count,@results)=KeywordSearch(undef,'intra',\%search,$num,$offset);
85 } elsif ($search{'front'} ne '') {
86 ($count,@results)=FrontSearch(undef,'intra',\%search,$num,$offset);
88 ($count,@results)=CatSearch(undef,'loose',\%search,$num,$offset);
92 print "You searched on ";
93 while ( my ($key, $value) = each %search) {
96 print bold("$key $value,");
99 print " $count results found";
100 my $offset2=$num+$offset;
101 my $dispnum=$offset+1;
102 print "<br> Results $dispnum to $offset2 displayed";
106 print mktablerow(6,$main,'<b>TITLE</b>','<b>AUTHOR</b>',bold('©'),'<b>COUNT</b>',bold('LOCATION'),'','/images/background-mem.gif');
110 if ($keyword ne '' && $offset > 0){
111 $count2=$count-$offset;
119 while ($i < $count2){
120 # print $results[$i]."\n";
121 # my @stuff=split('\t',$results[$i]);
122 my $result=$results[$i];
123 $result->{'title'}=~ s/\`/\\\'/g;
124 my $title2=$result->{'title'};
125 my $author2=$result->{'author'};
126 my $copyright=$result->{'copyrightdate'};
127 $author2=~ s/ /%20/g;
129 $title2=~ s/\#/\&\#x23;/g;
130 $title2=~ s/\"/\"\;/g;
133 if ($donation eq 'yes'){
134 $result->{'title'}=mklink("/cgi-bin/koha/acqui/newdonation.pl?author=$author2©right=$copyright&id=$id&basket=$basket&biblio=$result->{'biblionumber'}&title=$title2",$result->{'title'});
136 $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'});
138 my $word=$result->{'author'};
139 $word=~ s/([a-z]) +([a-z])/$1%20$2/ig;
142 $word=~ s/\,/\,%20/g;
144 my $url="/cgi-bin/koha/search.pl?author=$word&type=$type";
145 $result->{'author'}=mklink($url,$result->{'author'});
146 my ($count,$lcount,$nacount,$fcount,$scount,$lostcount,$mending,$transit)=C4::Search::itemcount($env,$result->{'biblionumber'},$type);
149 $location=$location."On Loan";
151 $location=$location." ($nacount)";
156 $location=$location."Levin";
158 $location=$location." ($lcount)";
163 $location=$location."Foxton";
165 $location=$location." ($fcount)";
170 $location=$location."Shannon";
172 $location=$location." ($scount)";
177 $location=$location."Lost";
179 $location=$location." ($lostcount)";
184 $location=$location."Mending";
186 $location=$location." ($mending)";
191 $location=$location."In Transiit";
193 $location=$location." ($transit)";
199 print mktablerow(6,$secondary,$result->{'title'},$result->{'author'},$result->{'copyrightdate'},$itemcount,$location);
202 print mktablerow(6,'white',$result->{'title'},$result->{'author'},$result->{'copyrightdate'},$itemcount,$location);
207 $offset=$num+$offset;
209 print mktablerow(6,$main,' ',' ',' ',' ','','','/images/background-mem.gif');
212 if ($offset < $count){
213 my $search="num=$num&offset=$offset&type=$type&id=$id&basket=$basket&search=$title&author=$author";
214 my $stuff=mklink("/cgi-bin/koha/acqui/newbasket2.pl?$search",'Next');
219 print endmenu('acquisitions');