<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 TRANSITIONAL//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=UTF-8">
<META NAME="GENERATOR" CONTENT="GtkHTML/3.6.2">
</HEAD>
<BODY>
Hello Chris,<BR>
<BR>
I edited my the figure for maxfines in my Fines2.pl to read: <BR>
<BR>
my $maxFine=5000 (this can be anything you want depending on your needs)<BR>
<BR>
then I edited my Fines.pm as follows<BR>
<BR>
Fines.pm (edited the sub CalcFine)<BR>
=============================================<BR>
<BR>
sub CalcFine {<BR>
my ($itemnumber,$bortype,$difference)=@_;<BR>
my $dbh = C4::Context->dbh;<BR>
<BR>
# Look up the categoryitem record for this book's item type and the<BR>
# given borrwer type.<BR>
# The reason this query is so messy is that it's a messy question:<BR>
# given the barcode, we can find the book's items record. This gives<BR>
# us the biblioitems record, which gives us a set of categoryitem<BR>
# records. Then we select the one that corresponds to the desired<BR>
# borrower type.<BR>
<BR>
# FIXME - Is it really necessary to get absolutely everything from<BR>
# all four tables? It looks as if this code only wants<BR>
# firstremind, chargeperiod, accountsent, and chargename from the<BR>
# categoryitem table.<BR>
<BR>
my $sth=$dbh->prepare("Select * from items,biblioitems,itemtypes,issuingrules where items.itemnumber=?<BR>
and items.biblioitemnumber=biblioitems.biblioitemnumber and<BR>
biblioitems.itemtype=itemtypes.itemtype and<BR>
issuingrules.itemtype=itemtypes.itemtype and<BR>
issuingrules.categorycode=? and (items.itemlost <> 1 or items.itemlost is NULL)");<BR>
<BR>
$sth->execute($itemnumber,$bortype);<BR>
my $data=$sth->fetchrow_hashref;<BR>
        # FIXME - Error-checking: the item might be lost, or there<BR>
        # might not be an entry in 'categoryitem' for this item type<BR>
        # or borrower type.<BR>
$sth->finish;<BR>
my $amount=0;<BR>
my $printout;<BR>
<BR>
# Is it time to send out the first reminder?<BR>
# FIXME - I'm not sure the "=="s are correct here. Let's say that<BR>
# $data->{firstremind} is today, but 'fines2.pl' doesn't run for<BR>
# some reason (the cron daemon died, the server crashed, the<BR>
# sysadmin had the machine down for maintenance, or whatever).<BR>
#<BR>
# Then the next day, the book is $data->{firstremind}+1 days<BR>
# overdue. But this function returns $amount == 0, $printout ==<BR>
# undef, on the assumption that 'fines2.pl' ran the previous day. So<BR>
# the first thing the patron gets is a second notice, but that's a<BR>
# week after the server crash, so people may not connect the two<BR>
# events.<BR>
if ($difference >= $data->{'Remind'}){<BR>
# Yes. Set the fine as listed.<BR>
$amount=$data->{'fine'}*$difference;<BR>
$printout="Fine Updated";<BR>
}<BR>
<BR>
# Is it time to send out a second reminder? (killing - Bernard)<BR>
#my $second=$data->{'firstremind'}+$data->{'chargeperiod'};<BR>
#if ($difference == $second){<BR>
# Yes. The fine is double.<BR>
# $amount=$data->{'fine'}*2;<BR>
#$printout="Second Notice";<BR>
#}<BR>
<BR>
# Is it time to send the account to a collection agency?<BR>
# FIXME - At least, I *think* that's what this code is doing.<BR>
#if ($difference == $data->{'accountsent'} && $data->{'fine'} > 0){ (killed - Bernard)<BR>
# Yes. Set the fine at 5 local monetary units.<BR>
# FIXME - This '5' shouldn't be hard-wired.<BR>
# $amount=5000;<BR>
#$printout="Final Notice";<BR>
#}<BR>
return($amount,$data->{'chargename'},$printout);<BR>
}<BR>
=======================================================<BR>
I'm still tweaking it but this seems to work OK for me (koha 2.2.5 on FC4)...<BR>
<BR>
Secondly, for your fines calculation to work OK, your issuing rules table MUST be in order. See an earlier post by Joshua on the 11th about this.<BR>
<BR>
Bernard Shiundu<BR>
Strathmore University<BR>
Nairobi, Kenya<BR>
<BR>
<BR>
<BR>
<BLOCKQUOTE TYPE=CITE>
<FONT COLOR="#000000">On Thu, 2006-03-16 at 12:00 +1300, koha-request@lists.katipo.co.nz wrote:</FONT>
<BLOCKQUOTE TYPE=CITE>
<PRE>
<FONT COLOR="#000000">With apologies for cross-posting.</FONT>
<FONT COLOR="#000000">I would like to know if anyone using Koha has managed to set up fines that</FONT>
<FONT COLOR="#000000">are applied each night, regardless of how many days the item is overdue by.</FONT>
<FONT COLOR="#000000">Put simply, what I'm looking for is: total fine = daily fine amount</FONT>
<FONT COLOR="#000000">(multiplied by) days overdue</FONT>
<FONT COLOR="#000000">I don't want the fine to stop being applied after 21 days or whatever, I'd</FONT>
<FONT COLOR="#000000">just like it to continue. Does anyone have such a setup? Could you send me</FONT>
<FONT COLOR="#000000">any related scripts/files?</FONT>
<FONT COLOR="#000000">I'm using Koha 2.2.4 W32 R0, if it makes a difference. I'm not a coder</FONT>
<FONT COLOR="#000000">myself (although I'm not scared of having a go at editing files), but just</FONT>
<FONT COLOR="#000000">can't get my head around the default fines scripts that come with Koha.</FONT>
<FONT COLOR="#000000">Regards,</FONT>
<FONT COLOR="#000000">Chris Hearn</FONT>
<FONT COLOR="#000000">Rheolwr y Siop Gopïo</FONT>
<FONT COLOR="#000000">Copy Shop Manager</FONT>
<FONT COLOR="#000000">-----------------------------------------------</FONT>
<FONT COLOR="#000000">Siop Gopïo Urdd Myfyrwyr Aberystwyth</FONT>
<FONT COLOR="#000000">mewn partneriaeth â Call Print</FONT>
<FONT COLOR="#000000"><A HREF="http://www.urddaber.co.uk/gwasanaethau/siopgopi">http://www.urddaber.co.uk/gwasanaethau/siopgopi</A></FONT>
<FONT COLOR="#000000">E-bost: <A HREF="mailto:undeb.siopgopi@aber.ac.uk">undeb.siopgopi@aber.ac.uk</A></FONT>
<FONT COLOR="#000000">Yr Undeb, Penglais, Aberystwyth, SY23 3DX</FONT>
<FONT COLOR="#000000">Ffôn: 01970 621705 Ffacs: 01970 621724</FONT>
<FONT COLOR="#000000"> </FONT>
<FONT COLOR="#000000">Aberystwyth Guild of Students Copy Shop</FONT>
<FONT COLOR="#000000">in partnership with Call Print</FONT>
<FONT COLOR="#000000"><A HREF="http://www.aberguild.co.uk/services/copyshop">www.aberguild.co.uk/services/copyshop</A></FONT>
<FONT COLOR="#000000">E-mail: <A HREF="mailto:union.copyshop@aber.ac.uk">union.copyshop@aber.ac.uk</A></FONT>
<FONT COLOR="#000000">The Union, Penglais, Aberystwyth, SY23 3DX</FONT>
<FONT COLOR="#000000">Phone: 01970 621705 Fax: 01970 621724</FONT>
<FONT COLOR="#000000"> </FONT>
</PRE>
</BLOCKQUOTE>
<PRE>
<FONT COLOR="#000000">_______________________________________________</FONT>
<FONT COLOR="#000000">Koha mailing list</FONT>
<FONT COLOR="#000000"><A HREF="mailto:Koha@lists.katipo.co.nz">Koha@lists.katipo.co.nz</A></FONT>
<FONT COLOR="#000000"><A HREF="http://lists.katipo.co.nz/mailman/listinfo/koha">http://lists.katipo.co.nz/mailman/listinfo/koha</A></FONT>
</PRE>
</BLOCKQUOTE>
<TABLE CELLSPACING="0" CELLPADDING="0" WIDTH="100%">
<TR>
<TD>
<HR NOSHADE>
<BR>
<BR>
Bernard Shiundu<BR>
Strathmore University<BR>
Madaraka Estate<BR>
Ole Sangale Road<BR>
P. O. Box 59857, 00200<BR>
Nairobi, Kenya <BR>
<BR>
Tel.: (+254) (0)20-606155 Ext 2251<BR>
Mob.: (+254) (0)722-205428, (0)733-618135<BR>
Fax.: (+254) (0)20-607498 <BR>
<BR>
<BR>
</TD>
</TR>
</TABLE>
</BODY>
</HTML>