From 3eecf2956e5c02bbf82190c4495f6edf29a9868b Mon Sep 17 00:00:00 2001 From: rangi Date: Sun, 17 Mar 2002 02:58:00 +0000 Subject: [PATCH] Deals with lost book charges now --- C4/Circulation/Fines.pm | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/C4/Circulation/Fines.pm b/C4/Circulation/Fines.pm index 52b5fe428d..794cf84a2d 100644 --- a/C4/Circulation/Fines.pm +++ b/C4/Circulation/Fines.pm @@ -13,7 +13,7 @@ use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS); $VERSION = 0.01; @ISA = qw(Exporter); -@EXPORT = qw(&Getoverdues &CalcFine &BorType &UpdateFine); +@EXPORT = qw(&Getoverdues &CalcFine &BorType &UpdateFine &ReplacementCost); %EXPORT_TAGS = ( ); # eg: TAG => [ qw!name1 name2! ], # your exported package globals go here, @@ -76,8 +76,7 @@ sub CalcFine { and items.biblioitemnumber=biblioitems.biblioitemnumber and biblioitems.itemtype=itemtypes.itemtype and categoryitem.itemtype=itemtypes.itemtype and - categoryitem.categorycode='$bortype' and (items.itemlost <> 1 or -items.itemlost is NULL)"; + categoryitem.categorycode='$bortype' and (items.itemlost <> 1 or items.itemlost is NULL)"; my $sth=$dbh->prepare($query); # print $query; $sth->execute; @@ -122,7 +121,7 @@ sub UpdateFine { my $query2="update accountlines set date=now(), amount=$amount, amountoutstanding=$out,accounttype='FU' where borrowernumber=$data->{'borrowernumber'} and itemnumber=$data->{'itemnumber'} - and (accounttype='FU' or accounttype='O');"; + and (accounttype='FU' or accounttype='O') and description like '%$due%'"; my $sth2=$dbh->prepare($query2); $sth2->execute; $sth2->finish; @@ -171,6 +170,17 @@ borrowers.categorycode=categories.categorycode"; return($data); } +sub ReplacementCost{ + my ($itemnum)=@_; + my $dbh=C4Connect; + my $query="Select replacementprice from items where itemnumber='$itemnum'"; + my $sth=$dbh->prepare($query); + $sth->execute; + my $data=$sth->fetchrow_hashref; + $sth->finish; + $dbh->disconnect; + return($data->{'replacementprice'}); +} END { } # module clean-up code here (global destructor) -- 2.39.5