Browse Source

Working on reserves

master
chris 22 years ago
parent
commit
bb5033184f
  1. 73
      C4/Reserves2.pm
  2. 17
      C4/Search.pm
  3. 59
      detail.pl
  4. 62
      moredetail.pl
  5. 300
      request.pl
  6. 23
      search.pl

73
C4/Reserves2.pm

@ -0,0 +1,73 @@
package C4::Reserves2; #asummes C4/Reserves2
#requires DBI.pm to be installed
#uses DBD:Pg
use strict;
require Exporter;
use DBI;
use C4::Database;
use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS);
# set the version for version checking
$VERSION = 0.01;
@ISA = qw(Exporter);
@EXPORT = qw(&FindReserves);
%EXPORT_TAGS = ( ); # eg: TAG => [ qw!name1 name2! ],
# your exported package globals go here,
# as well as any optionally exported functions
@EXPORT_OK = qw($Var1 %Hashit);
# non-exported package globals go here
use vars qw(@more $stuff);
# initalize package globals, first exported ones
my $Var1 = '';
my %Hashit = ();
# then the others (which are still accessible as $Some::Module::stuff)
my $stuff = '';
my @more = ();
# all file-scoped lexicals must be created before
# the functions below that use them.
# file-private lexicals go here
my $priv_var = '';
my %secret_hash = ();
# here's a file-private function as a closure,
# callable as &$priv_func; it cannot be prototyped.
my $priv_func = sub {
# stuff goes here.
};
# make all your functions, whether exported or not;
sub FindReserves {
my ($bib)=@_;
my $dbh=C4Connect;
my $query="Select * from reserves where biblionumber=$bib";
my $sth=$dbh->prepare($query);
$sth->execute;
my $i=0;
my @results;
while (my $data=$sth->fetchrow_hashref){
$results[$i]=$data;
$i++;
}
$sth->finish;
$dbh->disconnect;
return($i,\@results);
}
END { } # module clean-up code here (global destructor)

17
C4/Search.pm

@ -120,7 +120,8 @@ sub KeywordSearch {
$sth->execute;
$i=0;
while (my $data=$sth->fetchrow_hashref){
$results[$i]="$data->{'author'}\t$data->{'title'}\t$data->{'biblionumber'}";
$results[$i]="$data->{'author'}\t$data->{'title'}\t$data->{'biblionumber'}\t$data->{'copyrightdate'}";
# print $results[$i];
$i++;
}
@ -133,7 +134,8 @@ $i++;
biblionumber=$data->{'biblionumber'}");
$sth2->execute;
while (my $data2=$sth2->fetchrow_hashref){
$results[$i]="$data2->{'author'}\t$data2->{'title'}\t$data2->{'biblionumber'}";
$results[$i]="$data2->{'author'}\t$data2->{'title'}\t$data2->{'biblionumber'}\t$data->{'copyrightdate'}";
# print $results[$i];
$i++;
}
@ -281,10 +283,10 @@ sub CatSearch {
# } else {
while (my $data=$sth->fetchrow_hashref){
if ($type ne 'subject'){
$results[$i]="$data->{'author'}\t$data->{'title'}\t$data->{'biblionumber'}";
$results[$i]="$data->{'author'}\t$data->{'title'}\t$data->{'biblionumber'}\t$data->{'copyrightdate'}";
} elsif ($search->{'isbn'} ne ''){
} else {
$results[$i]="$data->{'author'}\t$data->{'subject'}\t$data->{'biblionumber'}";
$results[$i]="$data->{'author'}\t$data->{'subject'}\t$data->{'biblionumber'}\t$data->{'copyrightdate'}";
}
$i++;
}
@ -427,9 +429,12 @@ sub itemdata {
}
sub bibdata {
my ($title)=@_;
my ($bibnum)=@_;
my $dbh=C4Connect;
my $query="Select * from biblio where title='$title'";
my $query="Select * from biblio,biblioitems,bibliosubject,bibliosubtitle where biblio.biblionumber=$bibnum
and biblioitems.biblionumber=$bibnum and
(bibliosubject.biblionumber=$bibnum or bibliosubject.biblionumber=1) and
(bibliosubtitle.biblionumber=$bibnum or bibliosubtitle.biblionumber=1)";
# print $query;
my $sth=$dbh->prepare($query);
$sth->execute;

59
detail.pl

@ -27,40 +27,79 @@ print startpage();
print startmenu($type);
my $blah;
my $bib=$input->param('bib');
print "<a href=request.pl?bib=$bib><img height=42 WIDTH=187 BORDER=0 src=\"/images/place-request.gif\" align=right border=0></a>";
print mkheadr(3,'Items');
my $title=$input->param('title');
print "<a href=request.pl?bib=$bib><img height=42 WIDTH=120 BORDER=0 src=\"/images/requests.gif\" align=right border=0></a>";
print mkheadr(3,$title);
my @items=ItemInfo(\$blah,$bib,$title);
my $dat=bibdata($bib);
my $count=@items;
print <<printend
<TABLE CELLSPACING=0 CELLPADDING=5 border=1 align=left width="220">
my $title=$input->param('title');
<!-----------------BIBLIO RECORD TABLE--------->
<TR VALIGN=TOP>
<td bgcolor="99cc33" background="/images/background-mem.gif"><B>BIBLIO RECORD</TD></TR>
<tr VALIGN=TOP >
<TD>
<br>
<FONT SIZE=2 face="arial, helvetica">
Biblio Number: $bib<br>
Author: $dat->{'author'}<br>
Title: $title<br>
Copyright:$dat->{'copyrightdate'}<br>
Subtitle: $dat->{'subtitle'}<br>
Unititle: $dat->{'unititle'}<br>
Notes: $dat->{'notes'}<br>
Serial: $dat->{'serial'}<br>
Seriestitle: $dat->{'seriestitle'}<br>
Subject: $dat->{'subject'}<br>
Groups: $dat->{'classification'}<br>
Total Number of Items: $count
<p>
<INPUT TYPE="image" name="submit" VALUE="modify" height=42 WIDTH=93 BORDER=0 src="/images/modify-mem.gif">
</font></TD>
</TR>
</TABLE>
<img src="/images/holder.gif" width=16 height=250 align=left>
printend
;
my @items=ItemInfo(\$blah,$bib,$title);
#print @items;
my $count=@items;
my $i=0;
print center();
print mktablehdr;
if ($type eq 'opac'){
print mktablerow(7,$main,'Title','Itemtype','Class','Location','DateDue','Lastseen','Barcode');
print mktablerow(6,$main,'Itemtype','Class','Location','DateDue','Lastseen','Barcode');
} else {
print mktablerow(7,$main,'Title','Itemtype','Class','Location','DateDue','Lastseen','Barcode',"/images/background-mem.gif");
print mktablerow(6,$main,'Itemtype','Class','Location','DateDue','Lastseen','Barcode',"/images/background-mem.gif");
}
my $colour=1;
while ($i < $count){
my @results=split('\t',$items[$i]);
if ($type ne 'opac'){
$results[0]=mklink("/cgi-bin/koha/moredetail.pl?item=$results[5]",$results[0]);
$results[1]=mklink("/cgi-bin/koha/moredetail.pl?item=$results[5]",$results[1]);
}
if ($results[2] eq ''){
$results[2]='Available';
}
if ($colour == 1){
print mktablerow(7,$secondary,$results[0],$results[6],$results[4],$results[3],$results[2],$results[7],$results[1]);
print mktablerow(6,$secondary,$results[6],$results[4],$results[3],$results[2],$results[7],$results[1]);
$colour=0;
} else{
print mktablerow(7,'white',$results[0],$results[6],$results[4],$results[3],$results[2],$results[7],$results[1]);
print mktablerow(6,'white',$results[6],$results[4],$results[3],$results[2],$results[7],$results[1]);
$colour=1;
}
$i++;

62
moredetail.pl

@ -0,0 +1,62 @@
#!/usr/bin/perl
#script to display detailed information
#written 8/11/99
use strict;
#use DBI;
use C4::Search;
use CGI;
use C4::Output;
my $input = new CGI;
print $input->header;
#whether it is called from the opac of the intranet
my $type=$input->param('type');
#setup colours
my $main;
my $secondary;
if ($type eq 'opac'){
$main='#99cccc';
$secondary='#efe5ef';
} else {
$main='#cccc99';
$secondary='#ffffcc';
}
print startpage();
print startmenu($type);
my $blah;
my $bib=$input->param('bib');
my $title=$input->param('title');
my @items=ItemInfo(\$blah,$bib,$title);
#print @items;
my $count=@items;
my $i=0;
print center();
print mktablehdr;
print mktablerow(5,$main,'Title','Barcode','DateDue','Location','Dewey');
my $colour=1;
while ($i < $count){
my @results=split('\t',$items[$i]);
if ($type ne 'opac'){
$results[0]=mklink("/cgi-bin/koha/moredetail.pl?item=$results[5]",$results[0]);
}
if ($results[2] eq ''){
$results[2]='Available';
}
if ($colour == 1){
print mktablerow(5,$secondary,$results[0],$results[1],$results[2],$results[3],$results[4]);
$colour=0;
} else{
print mktablerow(5,'white',$results[0],$results[1],$results[2],$results[3],$results[4]);
$colour=1;
}
$i++;
}
print endcenter();
print mktableft();
print endmenu($type);
print endpage();

300
request.pl

@ -0,0 +1,300 @@
#!/usr/bin/perl
#script to place reserves/requests
#writen 2/1/00 by chris@katipo.oc.nz
use strict;
#use DBI;
use C4::Search;
use CGI;
use C4::Output;
my $input = new CGI;
print $input->header;
#setup colours
print startpage();
print startmenu();
my $blah;
my $bib=$input->param('bib');
my $dat=bibdata($bib);
#print $input->dump;
print <<printend
<FONT SIZE=6><em>Requesting: <a href=biblio.html>$dat->{'title'}</a> ($dat->{'author'})</em></FONT><P>
<p>
<INPUT TYPE="image" name="submit" VALUE="request" height=42 WIDTH=187 BORDER=0 src="/images/place-request.gif" align=right >
<TABLE CELLSPACING=0 CELLPADDING=5 border=1 align=left >
<!----------------BIBLIO RESERVE TABLE-------------->
<p align=right>
<form action="reserve.pl" method=post>
<TABLE CELLSPACING=0 CELLPADDING=5 border=1 >
<TR VALIGN=TOP>
<td bgcolor="99cc33" background="/images/background-mem.gif"><B>Rank</b></TD>
<td bgcolor="99cc33" background="/images/background-mem.gif"><B>Member</b></TD>
<td bgcolor="99cc33" background="/images/background-mem.gif"><B>Date</b></TD>
<td bgcolor="99cc33" background="/images/background-mem.gif"><B>Pickup</b></TD>
<td bgcolor="99cc33" background="/images/background-mem.gif"><B>Request</b></TD>
</TR>
<tr VALIGN=TOP >
<TD><select name=rank-request>
<option value=1>1
<option value=2>2
<option value=3>3
<option value=4 selected >4
</select>
</td>
<TD><input type=text size=20 name=member></td>
<TD>1/01/00</td>
<TD><select name=pickup>
<option value=levin>Levin
<option value=foxton>Foxton
<option value=Shannon>Shannon
</select>
</td>
<td><input type=checkbox name=request value=any>Next Available, <br>(or choose from list below)</td>
</tr>
</table>
</p>
<TABLE CELLSPACING=0 CELLPADDING=5 border=1 >
<TR VALIGN=TOP>
<td bgcolor="99cc33" background="/images/background-mem.gif"><B>Request</b></TD>
<td bgcolor="99cc33" background="/images/background-mem.gif"><B>Item Type</b></TD>
<td bgcolor="99cc33" background="/images/background-mem.gif"><B>Classification</b></TD>
<td bgcolor="99cc33" background="/images/background-mem.gif"><B>Volume</b></TD>
<td bgcolor="99cc33" background="/images/background-mem.gif"><B>Number</b></TD>
<td bgcolor="99cc33" background="/images/background-mem.gif"><B>Copyright</b></TD>
<td bgcolor="99cc33" background="/images/background-mem.gif"><B>Pubdate</b></TD>
<td bgcolor="99cc33" background="/images/background-mem.gif"><B>Copies</b></TD>
</TR>
<tr VALIGN=TOP >
<TD><input type=checkbox name=request value=bionumber>
</td>
<TD>Large Print</td>
<TD>Adult
</td>
<td>1</td>
<td>1</td>
<td>1997</td>
<td>1999</td>
<td>LO123456, available F</td>
</tr>
<tr VALIGN=TOP >
<TD><input type=checkbox name=request value=bionumber>
</td>
<TD>Adult Fiction</td>
<TD>Adult
</td>
<td>1</td>
<td>1</td>
<td>1997</td>
<td>1999</td>
<td>LO123457, due 1/2/00</td>
</tr>
</table>
</p>
<p>&nbsp; </p>
<!-----------MODIFY EXISTING REQUESTS----------------->
<TABLE CELLSPACING=0 CELLPADDING=5 border=1 >
<TR VALIGN=TOP>
<td bgcolor="99cc33" background="/images/background-mem.gif" colspan=6><B>MODIFY EXISTING REQUESTS </b></TD>
</TR>
<TR VALIGN=TOP>
<td bgcolor="99cc33" background="/images/background-mem.gif"><B>Rank</b></TD>
<td bgcolor="99cc33" background="/images/background-mem.gif"><B>Member</b></TD>
<td bgcolor="99cc33" background="/images/background-mem.gif"><B>Date</b></TD>
<td bgcolor="99cc33" background="/images/background-mem.gif"><B>Pickup</b></TD>
<td bgcolor="99cc33" background="/images/background-mem.gif"><B>Request</b></TD>
<td bgcolor="99cc33" background="/images/background-mem.gif"><B>Change To</b></TD>
</TR>
<tr VALIGN=TOP >
<TD><select name=rank-request>
<option value=1>1
<option value=2>2
<option value=3>3
<option value="">Del
</select>
</td>
<TD><a href=/members/rachey-record.html>Rachey Hamilton-Williams</a></td>
<TD>1/2/00</td>
<TD><select name=pickup>
<option value=levin>Levin
<option value=foxton>Foxton
<option value=Shannon>Shannon
</select>
</td>
<TD>Next Available</td>
<TD><select name=itemtype>
<option value=next>Next Available
<option value=change>Change Selection
<option value=nc >No Change
</select>
</td>
</tr>
<tr VALIGN=TOP >
<TD><select name=rank-request>
<option value=1>1
<option value=2 selected>2
<option value=3>3
<option value="">Del
</select>
</td>
<TD><a href=/members/rachey-record.html>Tod Jones</a></td>
<TD>1/2/00</td>
<TD><select name=pickup>
<option value=levin>Levin
<option value=foxton>Foxton
<option value=Shannon>Shannon
</select>
</td>
<TD>#23458</td>
<TD><select name=itemtype>
<option value=next>Next Available
<option value=change>Change Selection
<option value=nc >No Change
</select>
</td>
</tr>
<tr VALIGN=TOP >
<TD><select name=rank-request>
<option value=1>1
<option value=2>2
<option value=3 selected >3
<option value="">Del
</select>
</td>
<TD><a href=/members/rachey-record.html>Freida Daggeral</a></td>
<TD>1/2/00</td>
<TD><select name=pickup>
<option value=levin>Levin
<option value=foxton selected>Foxton
<option value=Shannon>Shannon
</select>
</td>
<TD>#23458</td>
<TD><select name=itemtype>
<option value=next>Next Available
<option value=change>Change Selection
<option value=nc >No Change
</select>
</td>
</tr>
<tr VALIGN=TOP >
<TD colspan=6 align=right>
Delete a request by selcting "del" from the rank list.
<INPUT TYPE="image" name="submit" VALUE="request" height=42 WIDTH=64 BORDER=0 src="/images/ok.gif"></td>
</tr>
</table>
<P>
<br>
</form>
printend
;
print endmenu();
print endpage();

23
search.pl

@ -89,13 +89,13 @@ if ($type ne 'opac'){
if ($subject ne ''){
print mktablerow(1,$main,'<b>SUBJECT</b>','/images/background-mem.gif');
} else {
print mktablerow(5,$main,'<b>TITLE</b>','<b>AUTHOR</b>',bold('&copy;'),'<b>COUNT</b>',bold('LOCATION'),'/images/background-mem.gif');
print mktablerow(6,$main,'<b>TITLE</b>','<b>AUTHOR</b>',bold('&copy;'),'<b>COUNT</b>',bold('LOCATION'),'','/images/background-mem.gif');
}
} else {
if ($subject ne ''){
print mktablerow(1,$main,'<b>SUBJECT</b>');
} else {
print mktablerow(4,$main,'<b>TITLE</b>','<b>AUTHOR</b>','<b>COUNT</b>',bold('LOCATION'));
print mktablerow(6,$main,'<b>TITLE</b>','<b>AUTHOR</b>',bold('&copy;'),'<b>COUNT</b>',bold('LOCATION'),'');
}
}
my $count2=@results;
@ -119,38 +119,39 @@ while ($i < $count2){
my $url="/cgi-bin/koha/search.pl?author=$word&type=$type";
$stuff[0]=mklink($url,$stuff[0]);
my ($count,$lcount,$nacount,$fcount,$scount)=itemcount($env,$stuff[2]);
$stuff[3]=$count;
$stuff[4]=$count;
if ($nacount > 0){
$stuff[4]=$stuff[4]."On Loan 1";
$stuff[5]=$stuff[5]."On Loan 1";
}
if ($lcount > 0){
$stuff[4]=$stuff[4]." L$lcount";
$stuff[5]=$stuff[5]." L$lcount";
}
if ($fcount > 0){
$stuff[4]=$stuff[4]." F$fcount";
$stuff[5]=$stuff[5]." F$fcount";
}
if ($scount > 0){
$stuff[4]=$stuff[4]." S$scount";
$stuff[5]=$stuff[5]." S$scount";
}
} else {
my $word=$stuff[1];
$word=~ s/ /%20/g;
$stuff[1]=mklink("/cgi-bin/koha/subjectsearch.pl?subject=$word",$stuff[1]);
}
$stuff[6]=mklink("/cgi-bin/koha/request.pl?bib=$stuff[2]","Request");
if ($colour == 1){
print mktablerow(4,$secondary,$stuff[1],$stuff[0],$stuff[3],$stuff[4]);
print mktablerow(6,$secondary,$stuff[1],$stuff[0],$stuff[3],$stuff[4],$stuff[5],$stuff[6]);
$colour=0;
} else{
print mktablerow(4,'white',$stuff[1],$stuff[0],$stuff[3],$stuff[4]);
print mktablerow(6,'white',$stuff[1],$stuff[0],$stuff[3],$stuff[4],$stuff[5],$stuff[6]);
$colour=1;
}
$i++;
}
$offset=$num+$offset;
if ($type ne 'opac'){
print mktablerow(4,$main,' &nbsp; ',' &nbsp; ',' &nbsp;',' &nbsp;','/images/background-mem.gif');
print mktablerow(6,$main,' &nbsp; ',' &nbsp; ',' &nbsp;',' &nbsp;','','','/images/background-mem.gif');
} else {
print mktablerow(4,$main,' &nbsp; ',' &nbsp; ',' &nbsp;',' &nbsp; ');
print mktablerow(6,$main,' &nbsp; ',' &nbsp; ',' &nbsp;',' &nbsp; ','','');
}
print mktableft();
if ($offset < $count){

Loading…
Cancel
Save