From da147ed7145a8f3c64e936086d67224dfa87e4b5 Mon Sep 17 00:00:00 2001 From: finlayt Date: Wed, 29 May 2002 04:33:42 +0000 Subject: [PATCH] Added the reserves functionality. Now calls a bunch of routines from Reserves2.pm --- circ/branchtransfers.pl | 166 +++++++++++++++++++++++++++++++++------- 1 file changed, 138 insertions(+), 28 deletions(-) diff --git a/circ/branchtransfers.pl b/circ/branchtransfers.pl index 6a451acfff..e11584cb65 100755 --- a/circ/branchtransfers.pl +++ b/circ/branchtransfers.pl @@ -7,6 +7,7 @@ use strict; use CGI; use C4::Circulation::Circ2; use C4::Output; +use C4::Reserves2; ############################################### # constants @@ -36,11 +37,12 @@ my $printer = $query->param("printer"); ($branch) || ($branch=$query->cookie('branch')) ; ($printer) || ($printer=$query->cookie('printer')) ; +my $request=$query->param('request'); + my $tobranchcd=$query->param('tobranchcd'); my $frbranchcd=''; - # set up the branchselect options.... my $tobranchoptions; foreach my $br (keys %$branches) { @@ -70,14 +72,47 @@ foreach ($query->param){ $ritext.="\n"; } + +# 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
"; +} +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'}
"; +} +if ($request eq 'KillReserved'){ + my $biblio = $query->param('biblionumber'); + my $borrnum = $query->param('borrowernumber'); + CancelReserve($biblio, 0, $borrnum); + $messagetext .= "Reserve Cancelled
"; +} + + + + # 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... +# if the barcode has been entered action that and write a message +# and put onto the top of the stack... my $iteminformation; -if (my $barcode=$query->param('barcode')) { +my $barcode = $query->param('barcode'); +if ($barcode) { my $transfered; my $iteminformation; - ($transfered, $messages, $iteminformation) = transferbook($tobranchcd, $barcode); + ($transfered, $messages, $iteminformation) + = transferbook($tobranchcd, $barcode, $ignoreRs); if ($transfered) { my $frbranchcd = $iteminformation->{'holdingbranch'}; $ritext.="\n"; @@ -92,6 +127,7 @@ if (my $barcode=$query->param('barcode')) { ################################################################################# # Html code.... +# collect together the various elements... my $entrytext= << "EOF";
@@ -119,12 +155,77 @@ EOF my $reservefoundtext; if ($messages->{'ResFound'}) { - my $resrec = $messages->{'ResFound'}; - my ($borr) = getpatroninformation(\%env, $resrec->{'borrowernumber'}, 0); + 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 = "{'borrowernumber'} onClick='openWindow(this,'Member', 480, 640)'>$borr->{'cardnumber'}"; - my $branch = $branches->{$resrec->{'branchcode'}}->{'branchname'}; - my $reservetext = "RESERVED for collection by $name ($number) at $branch "; + if ($res->{'ResFound'} eq "Waiting") { + $reservetext = <<"EOF"; +Item marked Waiting:
+ Item is marked waiting at $branchname for $name ($number).
+ + + + +
Cancel reservation and then attempt transfer: + +$ritext +{'itemnumber'}> +{'borrowernumber'}> + + + + + +
Ignore and return to transfers: +
+$ritext + + + +
+
+EOF + } + if ($res->{'ResFound'} eq "Reserved") { + $reservetext = <<"EOF"; +Reserved: reserve found for $name ($number). + + + + + +
Set reserve to waiting and transfer book to $branchname : +
+$ritext +{'itemnumber'}> +{'borrowernumber'}> + + + +
+
Cancel reservation and then attempt transfer: +
+$ritext +{'biblionumber'}> +{'borrowernumber'}> + + + + +
+
Ignore and return to transfers: +
+ + +$ritext + +
+
+EOF + } $reservefoundtext = <<"EOF"; @@ -134,7 +235,6 @@ EOF ##################### -my $messagetext=''; foreach my $code (keys %$messages) { if ($code eq 'BadBarcode'){ $messagetext .= " No Item with barcode: $messages->{'BadBarcode'}
"; @@ -157,6 +257,7 @@ EOF $messagetext .= "Item was on loan to $binfo and has been returned.
"; } if ($code eq 'WasTransfered'){ +# Put code here if you want to notify the user that item was transfered... } } $messagetext = substr($messagetext, 0, -4); @@ -167,6 +268,7 @@ if ($messagetext) {
Reserve Found
Messages
$messagetext
+ EOF } @@ -176,15 +278,22 @@ EOF print $query->header; print startpage; print startmenu('circulation'); + +#foreach my $key (%$messages) { +# print $key." : ".$messages->{$key}."
"; +#} + print <<"EOF";

- +
- +
Circulation: Transfers
Branch: $branches->{$branch}->{'branchname'}   Printer: $printers->{$printer}->{'printername'}
Change Settings
+ + Next Borrower || Returns || @@ -195,27 +304,27 @@ print <<"EOF";

EOF -print $reservefoundtext; - -print $messagetable; +if ($reservefoundtext) { + print $reservefoundtext; +} else { + print $messagetable; + print $entrytext; -print $entrytext; - -if (%transfereditems) { - print << "EOF"; + if (%transfereditems) { + print << "EOF";

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"; + 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"; @@ -226,8 +335,9 @@ EOF \n EOF -} - print "
Transfered Items
Bar CodeTitleAuthorTypeFromTo
{'biblionumber'} &type=intra onClick=\"openWindow(this, 'Item', 480, 640)\">$barcode$branches->{$tobcd}->{'branchname'}
\n"; + } + print "

\n"; + } } print endmenu('circulation'); -- 2.39.5