From fe459d2279a79c2c272b8415b2e9bb5cf89e44a3 Mon Sep 17 00:00:00 2001 From: finlayt Date: Wed, 2 Oct 2002 00:41:41 +0000 Subject: [PATCH] Cleaned out some warn statements. --- C4/Auth.pm | 10 ++++------ C4/Circulation/Circ2.pm | 39 +++++++++++++++------------------------ C4/Reserves2.pm | 4 +--- 3 files changed, 20 insertions(+), 33 deletions(-) diff --git a/C4/Auth.pm b/C4/Auth.pm index 4eb4767267..b6d68b65e3 100644 --- a/C4/Auth.pm +++ b/C4/Auth.pm @@ -52,10 +52,10 @@ sub getuserflags { $userflags->{$flag}=1; } } - warn "Userflags: \n"; - foreach my $f (keys %$userflags) { - warn ": Flag: $f => $userflags->{$f}\n "; - } +# warn "Userflags: \n"; +# foreach my $f (keys %$userflags) { +# warn ": Flag: $f => $userflags->{$f}\n "; +# } return $userflags; } @@ -79,7 +79,6 @@ sub checkauth { $sth->execute($sessionID); if ($sth->rows) { my ($userid, $ip, $lasttime) = $sth->fetchrow; - warn "userid, ip, lasttime = ".$userid.", ".$ip.", ".$lasttime."\n"; if ($lasttime{'superlibrarian'}=1; } foreach (keys %$flagsrequired) { - warn "Checking required flag $_"; unless ($flags->{superlibrarian}) { unless ($flags->{$_}) { print qq|Content-type: text/html diff --git a/C4/Circulation/Circ2.pm b/C4/Circulation/Circ2.pm index ba0718b7d4..11d4d1f039 100755 --- a/C4/Circulation/Circ2.pm +++ b/C4/Circulation/Circ2.pm @@ -136,6 +136,8 @@ sub getpatroninformation { $sth = $dbh->prepare($query); $sth->execute; my $borrower = $sth->fetchrow_hashref; + my $amount = checkaccount($env, $borrowernumber, $dbh); + $borrower->{'amountoutstanding'} = $amount; my $flags = patronflags($env, $borrower, $dbh); my $accessflagshash; @@ -149,7 +151,7 @@ sub getpatroninformation { $sth->finish; $dbh->disconnect; $borrower->{'flags'}=$flags; - return($borrower, $flags, $accessflagshash); + return ($borrower, $flags, $accessflagshash); } sub decode { @@ -709,7 +711,7 @@ sub patronflags { # Original subroutine for Circ2.pm my %flags; my ($env, $patroninformation, $dbh) = @_; - my $amount = checkaccount($env, $patroninformation->{'borrowernumber'}, $dbh); + my $amount = $patroninformation->{'amountoutstanding'}; if ($amount > 0) { my %flaginfo; $flaginfo{'message'}= sprintf "Patron owes \$%.02f", $amount; @@ -909,6 +911,7 @@ sub getissues { my $select = "SELECT issues.timestamp AS timestamp, issues.date_due AS date_due, items.biblionumber AS biblionumber, + items.itemnumber AS itemnumber, items.barcode AS barcode, biblio.title AS title, biblio.author AS author, @@ -966,32 +969,21 @@ sub checkwaiting { sub checkaccount { -# Stolen from Accounts.pm - #take borrower number - #check accounts and list amounts owing +# returns total amount oweing. my ($env,$bornumber,$dbh,$date)=@_; - my $select="Select sum(amountoutstanding) from accountlines where - borrowernumber=$bornumber and amountoutstanding<>0"; + my $select="SELECT SUM(amountoutstanding) AS total + FROM accountlines + WHERE borrowernumber = $bornumber + AND amountoutstanding<>0"; if ($date ne ''){ - $select.=" and date < '$date'"; + $select.=" AND date < '$date'"; } -# print $select; my $sth=$dbh->prepare($select); $sth->execute; - my $total=0; - while (my $data=$sth->fetchrow_hashref){ - $total=$total+$data->{'sum(amountoutstanding)'}; - } + my $data=$sth->fetchrow_hashref; + my $total = $data->{'total'}; $sth->finish; - # output(1,2,"borrower owes $total"); - #if ($total > 0){ - # # output(1,2,"borrower owes $total"); - # if ($total > 5){ - # reconcileaccount($env,$dbh,$bornumber,$total); - # } - #} - # pause(); - return($total); + return ($total); } sub renewstatus { @@ -1073,7 +1065,6 @@ sub renewbook { sub calc_charges { # Stolen from Issues.pm # calculate charges due - warn "Im in calc_charges!\n"; my ($env, $dbh, $itemno, $bornum)=@_; $dbh=C4Connect() unless $dbh; @@ -1085,7 +1076,7 @@ sub calc_charges { where (items.itemnumber ='$itemno') and (biblioitems.biblioitemnumber = items.biblioitemnumber) and (biblioitems.itemtype = itemtypes.itemtype)"; - warn "$q1\n"; + my $sth1= $dbh->prepare($q1); $sth1->execute; diff --git a/C4/Reserves2.pm b/C4/Reserves2.pm index d8a3b3088c..ea0565f861 100755 --- a/C4/Reserves2.pm +++ b/C4/Reserves2.pm @@ -40,7 +40,7 @@ sub FindReserves { my $dbh=C4Connect; my $query="SELECT *,reserves.branchcode,biblio.title AS btitle FROM reserves,borrowers,biblio "; - if ($bib ne ''){ + if ($bib){ $bib = $dbh->quote($bib); if ($bor ne ''){ $bor = $dbh->quote($bor); @@ -120,7 +120,6 @@ sub CheckReserves { sub CancelReserve { my ($biblio, $item, $borr) = @_; my $dbh=C4Connect; - warn "In CancelReserve"; if (($item and $borr) and (not $biblio)) { # removing a waiting reserve record.... $item = $dbh->quote($item); @@ -202,7 +201,6 @@ sub fixpriority { WHERE biblionumber = $nbib AND borrowernumber = $nbor AND reservedate = $nresd"; - warn $query; my $sth = $dbh->prepare($query); $sth->execute; $sth->finish;