2 #origninally script to provide intranet (librarian) advanced search facility
3 #now script to do searching for acquisitions
14 #whether it is called from the opac of the intranet
15 my $type=$input->param('type');
29 #build hash of users input
30 my $title=$input->param('search');
31 $search{'title'}=$title;
32 my $keyword=$input->param('d');
33 $search{'keyword'}=$keyword;
34 my $author=$input->param('author');
35 $search{'author'}=$author;
38 my $offset=$input->param('offset');
42 my $num=$input->param('num');
46 my $id=$input->param('id');
47 my $basket=$input->param('basket');
48 my $sub=$input->param('sub');
54 my ($count,@booksellers)=bookseller($id);
57 print startmenu('acquisitions');
58 print mkheadr(1,"Shopping Basket For: $booksellers[0]->{'name'}");
60 if ($donation ne 'yes'){
61 print "<a href=newbiblio.pl?id=$id&basket=$basket&sub=$sub>";
63 print "<a href=newdonation.pl?id=$id&basket=$basket&sub=$sub>";
66 <img src=/images/add-biblio.gif width=187 heigth=42 border=0 align=right alt="Add New Biblio"></a>
67 <a href=basket.pl?basket=$basket><img src=/images/view-basket.gif width=187 heigth=42 border=0 align=right alt="View Basket"></a>
69 <FORM ACTION="/cgi-bin/koha/acqui/newbasket2.pl">
70 <input type=hidden name=id value="$id">
71 <input type=hidden name=basket value="$basket">
72 <b>New Search: </b><INPUT TYPE="text" SIZE="25" NAME="search"></form>
83 ($count,@results)=&CatSearch(\$blah,'loose',\%search,$num,$offset);
86 print "You searched on ";
87 while ( my ($key, $value) = each %search) {
90 print bold("$key $value,");
93 print " $count results found";
94 my $offset2=$num+$offset;
95 my $dispnum=$offset+1;
96 print "<br> Results $dispnum to $offset2 displayed";
100 print mktablerow(6,$main,'<b>TITLE</b>','<b>AUTHOR</b>',bold('©'),'<b>COUNT</b>',bold('LOCATION'),'','/images/background-mem.gif');
104 if ($keyword ne '' && $offset > 0){
105 $count2=$count-$offset;
113 while ($i < $count2){
114 # print $results[$i]."\n";
115 # my @stuff=split('\t',$results[$i]);
116 my $result=$results[$i];
117 $result->{'title'}=~ s/\`/\\\'/g;
118 my $title2=$result->{'title'};
119 my $author2=$result->{'author'};
120 my $copyright=$result->{'copyrightdate'};
121 $author2=~ s/ /%20/g;
123 $title2=~ s/\#/\&\#x23;/g;
124 $title2=~ s/\"/\"\;/g;
127 if ($donation eq 'yes'){
128 $result->{'title'}=mklink("/cgi-bin/koha/acqui/newdonation.pl?author=$author2©right=$copyright&id=$id&basket=$basket&biblio=$result->{'biblionumber'}&title=$title2",$result->{'title'});
130 $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'});
132 my $word=$result->{'author'};
133 $word=~ s/([a-z]) +([a-z])/$1%20$2/ig;
136 $word=~ s/\,/\,%20/g;
138 my $url="/cgi-bin/koha/search.pl?author=$word&type=$type";
139 $result->{'author'}=mklink($url,$result->{'author'});
140 my ($count,$lcount,$nacount,$fcount,$scount,$lostcount,$mending,$transit)=itemcount($env,$result->{'biblionumber'},$type);
143 $location=$location."On Loan";
145 $location=$location." ($nacount)";
150 $location=$location."Levin";
152 $location=$location." ($lcount)";
157 $location=$location."Foxton";
159 $location=$location." ($fcount)";
164 $location=$location."Shannon";
166 $location=$location." ($scount)";
171 $location=$location."Lost";
173 $location=$location." ($lostcount)";
178 $location=$location."Mending";
180 $location=$location." ($mending)";
185 $location=$location."In Transiit";
187 $location=$location." ($transit)";
193 print mktablerow(6,$secondary,$result->{'title'},$result->{'author'},$result->{'copyrightdate'},$itemcount,$location);
196 print mktablerow(6,'white',$result->{'title'},$result->{'author'},$result->{'copyrightdate'},$itemcount,$location);
201 $offset=$num+$offset;
203 print mktablerow(6,$main,' ',' ',' ',' ','','','/images/background-mem.gif');
206 if ($offset < $count){
207 my $search="num=$num&offset=$offset&type=$type&id=$id&basket=$basket&search=$title&author=$author";
208 my $stuff=mklink("/cgi-bin/koha/acqui/newbasket2.pl?$search",'Next');
213 print endmenu('acquisitions');