[Koha-cvs] CVS: koha/circ branchtransfers.pl,1.7,1.8
Finlay Thompson
finlayt at users.sourceforge.net
Wed May 29 06:33:44 CEST 2002
Update of /cvsroot/koha/koha/circ
In directory usw-pr-cvs1:/tmp/cvs-serv12156/circ
Modified Files:
branchtransfers.pl
Log Message:
Added the reserves functionality. Now calls a bunch of routines from Reserves2.pm
Index: branchtransfers.pl
===================================================================
RCS file: /cvsroot/koha/koha/circ/branchtransfers.pl,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -r1.7 -r1.8
*** branchtransfers.pl 18 May 2002 05:38:57 -0000 1.7
--- branchtransfers.pl 29 May 2002 04:33:42 -0000 1.8
***************
*** 8,11 ****
--- 8,12 ----
use C4::Circulation::Circ2;
use C4::Output;
+ use C4::Reserves2;
###############################################
***************
*** 37,45 ****
($printer) || ($printer=$query->cookie('printer')) ;
my $tobranchcd=$query->param('tobranchcd');
my $frbranchcd='';
-
# set up the branchselect options....
my $tobranchoptions;
--- 38,47 ----
($printer) || ($printer=$query->cookie('printer')) ;
+ my $request=$query->param('request');
+
my $tobranchcd=$query->param('tobranchcd');
my $frbranchcd='';
# set up the branchselect options....
my $tobranchoptions;
***************
*** 71,82 ****
}
# Warnings etc that get displayed at top of next page....
my $messages;
! #if the barcode has been entered action that and write a message and onto the top of the stack...
my $iteminformation;
! if (my $barcode=$query->param('barcode')) {
my $transfered;
my $iteminformation;
! ($transfered, $messages, $iteminformation) = transferbook($tobranchcd, $barcode);
if ($transfered) {
my $frbranchcd = $iteminformation->{'holdingbranch'};
--- 73,117 ----
}
+
+ # Collect a few messages here...
+ my $messagetext='';
+
+ ############
+ # Deal with the requests....
+ if ($request eq "KillWaiting") {
+ my $item = $query->param('itemnumber');
+ my $borrnum = $query->param('borrowernumber');
+ CancelReserve(0, $item, $borrnum);
+ $messagetext .= "Reserve Cancelled<br>";
+ }
+ my $ignoreRs = 0;
+ if ($request eq "SetWaiting") {
+ my $item = $query->param('itemnumber');
+ my $borrnum = $query->param('borrowernumber');
+ $tobranchcd = ReserveWaiting($item, $borrnum);
+ $ignoreRs = 1;
+ $messagetext .= "Item should now be waiting at branch: $branches->{$tobranchcd}->{'branchname'}<br>";
+ }
+ if ($request eq 'KillReserved'){
+ my $biblio = $query->param('biblionumber');
+ my $borrnum = $query->param('borrowernumber');
+ CancelReserve($biblio, 0, $borrnum);
+ $messagetext .= "Reserve Cancelled<br>";
+ }
+
+
+
+
# Warnings etc that get displayed at top of next page....
my $messages;
! # if the barcode has been entered action that and write a message
! # and put onto the top of the stack...
my $iteminformation;
! my $barcode = $query->param('barcode');
! if ($barcode) {
my $transfered;
my $iteminformation;
! ($transfered, $messages, $iteminformation)
! = transferbook($tobranchcd, $barcode, $ignoreRs);
if ($transfered) {
my $frbranchcd = $iteminformation->{'holdingbranch'};
***************
*** 93,96 ****
--- 128,132 ----
#################################################################################
# Html code....
+ # collect together the various elements...
my $entrytext= << "EOF";
***************
*** 120,129 ****
my $reservefoundtext;
if ($messages->{'ResFound'}) {
! my $resrec = $messages->{'ResFound'};
! my ($borr) = getpatroninformation(\%env, $resrec->{'borrowernumber'}, 0);
my $name = $borr->{'surname'}." ".$borr->{'title'}." ".$borr->{'firstname'};
my $number = "<a href=/cgi-bin/koha/moremember.pl?bornum=$borr->{'borrowernumber'} onClick='openWindow(this,'Member', 480, 640)'>$borr->{'cardnumber'}</a>";
! my $branch = $branches->{$resrec->{'branchcode'}}->{'branchname'};
! my $reservetext = "<font size='+2' color='red'>RESERVED</font><font size='+2'> for collection by $name ($number) at $branch </font>";
$reservefoundtext = <<"EOF";
<table border=1 cellpadding=5 cellspacing=0 bgcolor='#dddddd'>
--- 156,230 ----
my $reservefoundtext;
if ($messages->{'ResFound'}) {
! my $res = $messages->{'ResFound'};
! my $reservetext;
! my $branchname = $branches->{$res->{'branchcode'}}->{'branchname'};
! my ($borr) = getpatroninformation(\%env, $res->{'borrowernumber'}, 0);
my $name = $borr->{'surname'}." ".$borr->{'title'}." ".$borr->{'firstname'};
my $number = "<a href=/cgi-bin/koha/moremember.pl?bornum=$borr->{'borrowernumber'} onClick='openWindow(this,'Member', 480, 640)'>$borr->{'cardnumber'}</a>";
! if ($res->{'ResFound'} eq "Waiting") {
! $reservetext = <<"EOF";
! <font color='red' size='+2'>Item marked Waiting:</font><br>
! Item is marked waiting at $branchname for $name ($number).<br>
! <table border=1 cellpadding=5 cellspacing=0>
! <tr><td>Cancel reservation and then attempt transfer: </td>
! <td>
! <form method=post action='branchtransfers.pl'>
! $ritext
! <input type=hidden name=itemnumber value=$res->{'itemnumber'}>
! <input type=hidden name=borrowernumber value=$res->{'borrowernumber'}>
! <input type=hidden name=tobranchcd value=$tobranchcd>
! <input type=hidden name=barcode value=$barcode>
! <input type=hidden name=request value='KillWaiting'>
! <input type=submit value="Cancel">
! </form>
! </td></tr>
! <tr><td>Ignore and return to transfers: </td>
! <td>
! <form method=post action='branchtransfers.pl'>
! $ritext
! <input type=hidden name=tobranchcd value=$tobranchcd>
! <input type=hidden name=barcode value=0>
! <input type=submit value="Ignore">
! </form>
! </td></tr></table>
! EOF
! }
! if ($res->{'ResFound'} eq "Reserved") {
! $reservetext = <<"EOF";
! <font color='red' size='+2'>Reserved:</font> reserve found for $name ($number).
! <table border=1 cellpadding=5 cellspacing=0>
! <tr><td>Set reserve to waiting and transfer book to <b>$branchname </b>: </td>
! <td>
! <form method=post action='branchtransfers.pl'>
! $ritext
! <input type=hidden name=itemnumber value=$res->{'itemnumber'}>
! <input type=hidden name=borrowernumber value=$res->{'borrowernumber'}>
! <input type=hidden name=barcode value=$barcode>
! <input type=hidden name=request value='SetWaiting'>
! <input type=submit value="Waiting">
! </form>
! </td></tr>
! <tr><td>Cancel reservation and then attempt transfer: </td>
! <td>
! <form method=post action='branchtransfers.pl'>
! $ritext
! <input type=hidden name=biblionumber value=$res->{'biblionumber'}>
! <input type=hidden name=borrowernumber value=$res->{'borrowernumber'}>
! <input type=hidden name=tobranchcd value=$tobranchcd>
! <input type=hidden name=barcode value=$barcode>
! <input type=hidden name=request value='KillReserved'>
! <input type=submit value="Cancel">
! </form>
! </td></tr><tr><td>Ignore and return to transfers: </td>
! <td>
! <form method=post action='branchtransfers.pl'>
! <input type=hidden name=tobranchcd value=$tobranchcd>
! <input type=hidden name=barcode value=0>
! $ritext
! <input type=submit value="Ignore">
! </form>
! </td></tr></table>
! EOF
! }
$reservefoundtext = <<"EOF";
<table border=1 cellpadding=5 cellspacing=0 bgcolor='#dddddd'>
***************
*** 135,139 ****
#####################
- my $messagetext='';
foreach my $code (keys %$messages) {
if ($code eq 'BadBarcode'){
--- 236,239 ----
***************
*** 158,161 ****
--- 258,262 ----
}
if ($code eq 'WasTransfered'){
+ # Put code here if you want to notify the user that item was transfered...
}
}
***************
*** 168,171 ****
--- 269,273 ----
<tr><th bgcolor=$headerbackgroundcolor background=$backgroundimage><font>Messages</font></th></tr>
<tr><td> $messagetext </td></tr></table>
+ <img src="/images/holder.gif" width=24 height=24>
EOF
}
***************
*** 177,183 ****
print startpage;
print startmenu('circulation');
print <<"EOF";
<p>
! <table border=0 cellpadding=5 width=90%><tr>
<td align="left"><FONT SIZE=6><em>Circulation: Transfers</em></FONT><br>
<b>Branch:</b> $branches->{$branch}->{'branchname'}  
--- 279,290 ----
print startpage;
print startmenu('circulation');
+
+ #foreach my $key (%$messages) {
+ # print $key." : ".$messages->{$key}."<br>";
+ #}
+
print <<"EOF";
<p>
! <table border=0 cellpadding=5><tr>
<td align="left"><FONT SIZE=6><em>Circulation: Transfers</em></FONT><br>
<b>Branch:</b> $branches->{$branch}->{'branchname'}  
***************
*** 185,189 ****
<a href=selectbranchprinter.pl>Change Settings</a>
</td>
! <td align="right">
<FONT SIZE=2 face="arial, helvetica">
<a href=circulation.pl>Next Borrower</a> ||
--- 292,298 ----
<a href=selectbranchprinter.pl>Change Settings</a>
</td>
! <td align="left"><img src="/images/holder.gif" width=40 height=35>
! </td>
! <td align="right" valign="top">
<FONT SIZE=2 face="arial, helvetica">
<a href=circulation.pl>Next Borrower</a> ||
***************
*** 196,207 ****
EOF
! print $reservefoundtext;
!
! print $messagetable;
! print $entrytext;
!
! if (%transfereditems) {
! print << "EOF";
<p>
<table border=1 cellpadding=5 cellspacing=0 bgcolor=#dddddd>
--- 305,316 ----
EOF
! if ($reservefoundtext) {
! print $reservefoundtext;
! } else {
! print $messagetable;
! print $entrytext;
! if (%transfereditems) {
! print << "EOF";
<p>
<table border=1 cellpadding=5 cellspacing=0 bgcolor=#dddddd>
***************
*** 209,220 ****
<tr><th>Bar Code</th><th>Title</th><th>Author</th><th>Type</th><th>From</th><th>To</th></tr>
EOF
! my $color='';
! foreach (keys %transfereditems) {
! ($color eq $linecolor1) ? ($color=$linecolor2) : ($color=$linecolor1);
! my $barcode=$transfereditems{$_};
! my $frbcd=$frbranchcds{$_};
! my $tobcd=$tobranchcds{$_};
! my ($iteminformation) = getiteminformation(\%env, 0, $barcode);
! print << "EOF";
<tr><td bgcolor=$color align=center>
<a href=/cgi-bin/koha/detail.pl?bib=$iteminformation->{'biblionumber'}
--- 318,329 ----
<tr><th>Bar Code</th><th>Title</th><th>Author</th><th>Type</th><th>From</th><th>To</th></tr>
EOF
! my $color='';
! foreach (sort keys %transfereditems) {
! ($color eq $linecolor1) ? ($color=$linecolor2) : ($color=$linecolor1);
! my $barcode=$transfereditems{$_};
! my $frbcd=$frbranchcds{$_};
! my $tobcd=$tobranchcds{$_};
! my ($iteminformation) = getiteminformation(\%env, 0, $barcode);
! print << "EOF";
<tr><td bgcolor=$color align=center>
<a href=/cgi-bin/koha/detail.pl?bib=$iteminformation->{'biblionumber'}
***************
*** 227,232 ****
</tr>\n
EOF
! }
! print "</table>\n";
}
--- 336,342 ----
</tr>\n
EOF
! }
! print "</table>\n";
! }
}
More information about the Koha-cvs
mailing list