From 73706c24f780aa22e9642be5556954604c4cf98e Mon Sep 17 00:00:00 2001 From: finlayt Date: Sat, 18 May 2002 05:07:26 +0000 Subject: [PATCH] improoved layout and branch and printer settings are displayed --- circ/returns.pl | 93 +++++++++++++++++++++++++++++++++---------------- 1 file changed, 63 insertions(+), 30 deletions(-) diff --git a/circ/returns.pl b/circ/returns.pl index c04c850e74..952797dfcd 100755 --- a/circ/returns.pl +++ b/circ/returns.pl @@ -20,6 +20,7 @@ my $backgroundimage="/images/background-mem.gif"; my $query=new CGI; my $branches = getbranches(); +my $printers = getprinters(\%env); my $branch = $query->param("branch"); my $printer = $query->param("printer"); @@ -27,6 +28,8 @@ my $printer = $query->param("printer"); ($branch) || ($branch=$query->cookie('branch')) ; ($printer) || ($printer=$query->cookie('printer')) ; + + # # Some code to handle the error if there is no branch or printer setting..... # @@ -66,7 +69,7 @@ my $messages; if (my $barcode = $query->param('barcode')) { # decode cuecat $barcode = cuecatbarcodedecode($barcode); - ($returned, $messages, $iteminformation, $borrower) = returnbook2(\%env, $barcode); + ($returned, $messages, $iteminformation, $borrower) = returnbook($barcode, $branch); if ($returned) { $returneditems{0} = $barcode; $riborrowernumber{0} = $borrower->{'borrowernumber'}; @@ -81,13 +84,22 @@ if (my $barcode = $query->param('barcode')) { # HTML code.... # title.... my $title = <<"EOF"; -

+

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

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

+

+ + +

EOF my $itemtable; @@ -111,7 +123,7 @@ EOF } # Barcode entry box, with hidden inputs attached.... -my $barcodeentrytext= << "EOF"; +my $barcodeentrytext = << "EOF";
@@ -124,27 +136,52 @@ $ritext EOF +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 +} + # collect the messages and put into message table.... -my $messagetable; -if ($messages) { - my $messagetext=''; - foreach (@$messages) { - $messagetext .= "$_
"; +my $messagetext=''; +foreach my $code (keys %$messages) { + if ($code eq 'BadBarcode'){ + $messagetext .= " No Item with barcode: $messages->{'BadBarcode'}
"; } - $messagetext = substr($messagetext, 0, -4); - if ($messagetext) { - $messagetable = << "EOF"; - - - -
Messages
-$messagetext -
-

-EOF + if ($code eq 'NotIssued'){ + my $braname = $branches->{$messages->{'IsPermanent'}}->{'branchname'}; + $messagetext .= " Item is not Issued, cannot be returned.
"; + } + if ($code eq 'WasLost'){ + $messagetext .= " Item was lost, now found.
"; } + if (($code eq 'IsPermanent') && (not $messages->{'ResFound'})) { + if ($messages->{'IsPermanent'} ne $branch) { + $messagetext .= " Item is part of permanent collection, please return to $branches->{$messages->{'IsPermanent'}}->{'branchname'}
"; + } + } +} +$messagetext = substr($messagetext, 0, -4); + +my $messagetable; +if ($messagetext) { + $messagetable = << "EOF"; + + +
Messages
$messagetext
+EOF } + # patrontable .... my $borrowertable; if ($borrower) { @@ -276,23 +313,19 @@ $returneditemstable .= "

\n"; # actually print the page! - - print $query->header(); print startpage(); print startmenu('circulation'); print $title; -# my $flags = $borrower->{'flags'}; -# foreach my $key (keys %$flags) { -# print "$key : $flags->{$key}
"; -# } +print $reservefoundtext; print $barcodeentrytext; print $messagetable; + if ($returned) { print $itemtable; print $borrowertable; -- 2.39.5