From e9bfecc3a428de0b4ebd3f921d45d91875ee49f3 Mon Sep 17 00:00:00 2001 From: finlayt Date: Wed, 29 May 2002 05:50:52 +0000 Subject: [PATCH] Fixed up the reserves code to use the new Reserves2.pm methods. --- circ/returns.pl | 121 ++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 107 insertions(+), 14 deletions(-) diff --git a/circ/returns.pl b/circ/returns.pl index 952797dfcd..8aaa740e85 100755 --- a/circ/returns.pl +++ b/circ/returns.pl @@ -8,7 +8,7 @@ use CGI; use C4::Circulation::Circ2; use C4::Search; use C4::Output; - +use C4::Reserves2; my %env; my $headerbackgroundcolor='#99cc33'; @@ -28,12 +28,14 @@ my $printer = $query->param("printer"); ($branch) || ($branch=$query->cookie('branch')) ; ($printer) || ($printer=$query->cookie('printer')) ; +my $request=$query->param('request'); # # Some code to handle the error if there is no branch or printer setting..... # + $env{'branchcode'}=$branch; $env{'printer'}=$printer; $env{'queue'}=$printer; @@ -61,12 +63,41 @@ 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
"; +} +if ($request eq "SetWaiting") { + my $item = $query->param('itemnumber'); + my $borrnum = $query->param('borrowernumber'); + my $barcode2 = $query->param('barcode2'); + my $tobranchcd = ReserveWaiting($item, $borrnum); + my ($transfered, $messages, $iteminfo) = transferbook($tobranchcd, $barcode2, 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
"; +} + + + my $iteminformation; my $borrower; my $returned = 0; my $messages; +my $barcode = $query->param('barcode'); # actually return book (SQL CALL) and prepare item table..... -if (my $barcode = $query->param('barcode')) { +if ($barcode) { # decode cuecat $barcode = cuecatbarcodedecode($barcode); ($returned, $messages, $iteminformation, $borrower) = returnbook($barcode, $branch); @@ -91,7 +122,7 @@ my $title = <<"EOF"; Printer: $printers->{$printer}->{'printername'}
Change Settings - + Next Borrower || Returns || @@ -130,29 +161,90 @@ my $barcodeentrytext = << "EOF"; Enter Book Barcode Item Barcode: - - $ritext + 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: +
+$ritext +{'itemnumber'}> +{'borrowernumber'}> + + + +
+
Back to returns: +
+$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: +
+$ritext +{'biblionumber'}> +{'borrowernumber'}> + + + +
+
Back to returns: +
+ +$ritext + +
+
+EOF + } $reservefoundtext = <<"EOF";
Reserve Found
$reservetext
+ EOF } # collect the messages and put into message table.... -my $messagetext=''; foreach my $code (keys %$messages) { if ($code eq 'BadBarcode'){ $messagetext .= " No Item with barcode: $messages->{'BadBarcode'}
"; @@ -319,13 +411,14 @@ print startmenu('circulation'); print $title; -print $reservefoundtext; - -print $barcodeentrytext; +if ($reservefoundtext) { + print $reservefoundtext; +} else { + print $barcodeentrytext; +} print $messagetable; - if ($returned) { print $itemtable; print $borrowertable; -- 2.39.5