diff --git a/circ/returns.pl b/circ/returns.pl
index 13cac15f87..c1826e7158 100755
--- a/circ/returns.pl
+++ b/circ/returns.pl
@@ -90,6 +90,7 @@ if ($query->param('resbarcode')) {
my $item = $query->param('itemnumber');
my $borrnum = $query->param('borrowernumber');
my $resbarcode = $query->param('resbarcode');
+# set to waiting....
my $tobranchcd = ReserveWaiting($item, $borrnum);
my $branchname = $branches->{$tobranchcd}->{'branchname'};
my ($borr) = getpatroninformation(\%env, $borrnum, 0);
@@ -124,18 +125,24 @@ if ($barcode) {
# decode cuecat
$barcode = cuecatbarcodedecode($barcode);
($returned, $messages, $iteminformation, $borrower) = returnbook($barcode, $branch);
- $returneditems{0} = $barcode;
$ritext.= "\n";
if ($returned) {
+ $returneditems{0} = $barcode;
$riborrowernumber{0} = $borrower->{'borrowernumber'};
$riduedate{0} = $iteminformation->{'date_due'};
$ritext.= "{'date_due'}>\n";
$ritext.= "{'borrowernumber'}>\n";
- } else {
- $riborrowernumber{0} = 0;
+ } elsif (! $messages->{'BadBarcode'}) {
+ $returneditems{0} = $barcode;
$riduedate{0} = 0;
$ritext.= "\n";
- $ritext.= "\n";
+ if ($messages->{'wthdrawn'}) {
+ $ritext.= "\n";
+ $riborrowernumber{0} = 'Item Cancelled';
+ } else {
+ $ritext.= "\n";
+ $riborrowernumber{0} = ' ';
+ }
}
}
@@ -282,8 +289,9 @@ foreach my $code (keys %$messages) {
if ($code eq 'WasLost'){
$messagetext .= " Item was lost, now found.
";
}
- if ($code eq 'wthdrawm'){
- $messagetext .= " Item Cancelled.
";
+ if ($code eq 'wthdrawn'){
+ $messagetext = " Item Cancelled.
";
+ last;
}
if (($code eq 'IsPermanent') && (not $messages->{'ResFound'})) {
if ($messages->{'IsPermanent'} ne $branch) {
@@ -393,6 +401,7 @@ foreach (sort {$a <=> $b} keys %returneditems) {
my $barcode = $returneditems{$_};
my $duedate = $riduedate{$_};
my $overduetext;
+ my $borrowerinfo;
if ($duedate) {
my @tempdate = split ( /-/ , $duedate ) ;
my $duedatenz = "$tempdate[2]/$tempdate[1]/$tempdate[0]";
@@ -401,16 +410,11 @@ foreach (sort {$a <=> $b} keys %returneditems) {
$overduetext = "$duedatenz";
($overduetext="$duedate") if ($duedate lt $todaysdate);
($duedatenz) || ($overduetext = "
");
+ my ($borrower) = getpatroninformation(\%env, $riborrowernumber{$_}, 0);
+ $borrowerinfo = "{'borrowernumber'} onClick=\"openWindow(this,'Member', 480, 640)\">$borrower->{'cardnumber'} $borrower->{'firstname'} $borrower->{'surname'}";
} else {
- $overduetext = "Not on loan.";
- }
- my $borrowernumber = $riborrowernumber{$_};
- my $borrowerinfo;
- if ($borrowernumber) {
- my ($borrower) = getpatroninformation(\%env,$borrowernumber,0);
- my $borrowerinfo = "{'borrowernumber'} onClick=\"openWindow(this,'Member', 480, 640)\">$borrower->{'cardnumber'} $borrower->{'firstname'} $borrower->{'surname'}";
- } else {
- $borrowerinfo = "Not on loan.";
+ $overduetext = "Not on Issue.";
+ $borrowerinfo = $riborrowernumber{$_};
}
my ($iteminformation) = getiteminformation(\%env, 0, $barcode);;
$returneditemstable .= << "EOF";
@@ -436,9 +440,18 @@ print $query->header();
print startpage();
print startmenu('circulation');
+
+#debug
+# foreach my $key (keys %$messages) {
+# print "$key : $messages->{$key}
";
+# }
+
+
print <<"EOF";
$links
$title
+
+