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