From 65b3df77cc33e3c77ed4884331e0483771cc4ee9 Mon Sep 17 00:00:00 2001 From: finlayt Date: Sat, 18 May 2002 05:04:43 +0000 Subject: [PATCH] fixed the branch and printer setting mechanism changed layout slightly --- circ/branchtransfers.pl | 105 ++++++++++++++++++++++++++++++++-------- 1 file changed, 85 insertions(+), 20 deletions(-) diff --git a/circ/branchtransfers.pl b/circ/branchtransfers.pl index 32476dd83a..21d8f7d8de 100755 --- a/circ/branchtransfers.pl +++ b/circ/branchtransfers.pl @@ -19,13 +19,24 @@ my $linecolor1='#ffffcc'; my $linecolor2='white'; my $backgroundimage="/images/background-mem.gif"; -my $branches=getbranches(); +my $branches = getbranches(); +my $printers = getprinters(\%env); + ############################################### # Getting state my $query=new CGI; + +my $branch = $query->param("branch"); +my $printer = $query->param("printer"); + + +($branch) || ($branch=$query->cookie('branch')) ; +($printer) || ($printer=$query->cookie('printer')) ; + + my $tobranchcd=$query->param('tobranchcd'); my $frbranchcd=''; @@ -60,17 +71,14 @@ foreach ($query->param){ } # Warnings etc that get displayed at top of next page.... -my @messages; - +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 $iteminformation = getiteminformation(\%env,0 ,$barcode); - my ($transfered, $message, $iteminformation) = transferbook($tobranchcd, $barcode); - if (not $transfered) { - push(@messages, $message); - } - else { + my $transfered; + my $iteminformation; + ($transfered, $messages, $iteminformation) = transferbook($tobranchcd, $barcode); + if ($transfered) { my $frbranchcd = $iteminformation->{'holdingbranch'}; $ritext.="\n"; $ritext.="\n"; @@ -78,10 +86,10 @@ if (my $barcode=$query->param('barcode')) { $transfereditems{0}=$barcode; $frbranchcds{0}=$frbranchcd; $tobranchcds{0}=$tobranchcd; - push(@messages, "Book: $barcode has been transfered"); } } + ################################################################################# # Html code.... @@ -105,13 +113,56 @@ $ritext EOF -my $messagetable; -if (@messages) { - my $messagetext=''; - foreach (@messages) { - $messagetext.="$_
"; + + +##################### + +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 = "{'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 "; + $reservefoundtext = <<"EOF"; + + +
Reserve Found
$reservetext
+EOF +} + +##################### + +my $messagetext=''; +foreach my $code (keys %$messages) { + if ($code eq 'BadBarcode'){ + $messagetext .= " No Item with barcode: $messages->{'BadBarcode'}
"; + } + if ($code eq 'IsPermanent'){ + my $braname = $branches->{$messages->{'IsPermanent'}}->{'branchname'}; + $messagetext .= " Please return item to home branch: $braname
"; + } + if ($code eq 'DestinationEqualsHolding'){ + $messagetext .= " Item cannot be transfered to branch it is already at.
"; + } + if ($code eq 'WasReturned') { + my ($borrowerinfo) = getpatroninformation(\%env, $messages->{'WasReturned'}, 0); + + my $binfo = <<"EOF"; +{'borrowernumber'} +onClick="openWindow(this,'Member', 480, 640)">$borrowerinfo->{'cardnumber'} +$borrowerinfo->{'surname'}, $borrowerinfo->{'title'} $borrowerinfo->{'firstname'} +EOF + $messagetext .= "Item was on loan to $binfo and has been returned.
"; } - $messagetext = substr($messagetext, 0, -4); + if ($code eq 'WasTransfered'){ + } +} +$messagetext = substr($messagetext, 0, -4); + +my $messagetable; +if ($messagetext) { $messagetable = << "EOF"; @@ -126,13 +177,26 @@ print $query->header; print startpage; print startmenu('circulation'); print <<"EOF"; -

+

+

Messages
+ +
Circulation: Transfers
+Branch: $branches->{$branch}->{'branchname'}   +Printer: $printers->{$printer}->{'printername'}
+Change Settings +
-Next Borrower || -Returns || -Transfers

Circulation: Transfers
+Next Borrower || +Returns || +Transfers

+

+ + +

EOF +print $reservefoundtext; + print $messagetable; print $entrytext; @@ -169,3 +233,4 @@ EOF print endmenu('circulation'); print endpage; + -- 2.39.5