C4::Circulation::Fines - Koha module dealing with fines
use C4::Overdues;
This module contains several functions for dealing with fines for overdue items. It is primarily used by the 'misc/fines2.pl' script.
$overdues = Getoverdues( { minimumdays => 1, maximumdays => 30 } );
Returns the list of all overdue books, with their itemtype.
$overdues
is a reference-to-array. Each element is a reference-to-hash whose keys are the fields of the issues table in the Koha database.
( $count, $overdueitems )=checkoverdues( $borrowernumber, $dbh );
Not exported
($amount, $chargename, $daycount, $daycounttotal) = &CalcFine($item, $categorycode, $branch, $days_overdue, $description, $start_date, $end_date );
Calculates the fine for a book.
The issuingrules table in the Koha database is a fine matrix, listing the penalties for each type of patron for each type of item and each branch (e.g., the standard fine for books might be $0.50, but $1.50 for DVDs, or staff members might get a longer grace period between the first and second reminders that a book is overdue).
$item
is an item object (hashref).
$categorycode
is the category code (string) of the patron who currently has the book.
$branchcode
is the library (string) whose issuingrules govern this transaction.
$days_overdue
is the number of days elapsed since the book's due date. NOTE: supplying days_overdue is deprecated.
$start_date
& $end_date
are C4::Dates objects defining the date range over which to determine the fine. Note that if these are defined, we ignore $difference
and $dues
, but retain these for backwards-comptibility with extant fines scripts.
Fines scripts should just supply the date range over which to calculate the fine.
&CalcFine
returns four values:
$amount
is the fine owed by the patron (see above).
$chargename
is the chargename field from the applicable record in the categoryitem table, whatever that is.
$daycount
is the number of days between start and end dates, Calendar adjusted (where needed), minus any applicable grace period.
$daycounttotal
is $daycount
without consideration of grace period.
FIXME - What is chargename supposed to be ?
FIXME: previously attempted to return $message
as a text message, either "First Notice", "Second Notice", or "Final Notice". But CalcFine never defined any value.
&GetSpecialHolidays($date_dues,$itemnumber);
return number of special days between date of the day and date due
$date_dues
is the envisaged date of book return.
$itemnumber
is the book's item number.
&GetRepeatableHolidays($date_dues, $itemnumber, $difference,);
return number of day closed between date of the day and date due
$date_dues
is the envisaged date of book return.
$itemnumber
is item number.
$difference
numbers of between day date of the day and date due
&Getwdayfromitemnumber($itemnumber);
return the different week day from repeatable_holidays table
$itemnumber
is item number.
&GetIssuesIteminfo($itemnumber);
return all data from issues about item
$itemnumber
is item number.
&UpdateFine($itemnumber, $borrowernumber, $amount, $type, $description);
(Note: the following is mostly conjecture and guesswork.)
Updates the fine owed on an overdue book.
$itemnumber
is the book's item number.
$borrowernumber
is the borrower number of the patron who currently has the book on loan.
$amount
is the current amount owed by the patron.
$type
will be used in the description of the fine.
$description
is a string that must be present in the description of the fine. I think this is expected to be a date in DD/MM/YYYY format.
&UpdateFine
looks up the amount currently owed on the given item and sets it to $amount
, creating, if necessary, a new entry in the accountlines table of the Koha database.
$borrower = &BorType($borrowernumber);
Looks up a patron by borrower number.
$borrower
is a reference-to-hash whose keys are all of the fields from the borrowers and categories tables of the Koha database. Thus, $borrower
contains all information about both the borrower and category he or she belongs to.
$cost = &ReplacementCost($itemnumber);
Returns the replacement cost of the item with the given item number.
$data->{'sum(amountoutstanding)'} = &GetFine($itemnum,$borrowernumber);
return the total of fine
$itemnum
is item number
$borrowernumber
is the borrowernumber
FIXME - This sub should be deprecated and removed. It ignores branch and defaults.
$data = &GetIssuingRules($itemtype,$categorycode);
Looks up for all issuingrules an item info
$itemnumber
is a reference-to-hash whose keys are all of the fields from the borrowers and categories tables of the Koha database. Thus,
$categorycode
contains information about borrowers category
$data
contains all information about both the borrower and category he or she belongs to.
($result) = &GetNextIdNotify($reference);
Returns the new file number
$result
contains the next file number
$reference
contains the beggining of file number
(@notify) = &NumberNotifyId($borrowernumber);
Returns amount for all file per borrowers @notify
array contains all file per borrowers
$notify_id
contains the file number for the borrower number nad item number
($totalnotify) = &AmountNotify($notifyid);
Returns amount for all file per borrowers $notifyid
is the file number
$totalnotify
contains amount of a file
$notify_id
contains the file number for the borrower number and item number
($notify_id) = &GetNotifyId($borrowernumber,$itemnumber);
Returns the file number per borrower and itemnumber
$borrowernumber
is a reference-to-hash whose keys are all of the fields from the items tables of the Koha database. Thus,
$itemnumber
contains the borrower categorycode
$notify_id
contains the file number for the borrower number nad item number
() = &CreateItemAccountLine($borrowernumber,$itemnumber,$date,$amount,$description,$accounttype,$amountoutstanding,$timestamp,$notify_id,$level);
update the account lines with file number or with file level
$items
is a reference-to-hash whose keys are all of the fields from the items tables of the Koha database. Thus,
$itemnumber
contains the item number
$borrowernumber
contains the borrower number
$date
contains the date of the day
$amount
contains item price
$description
contains the descritpion of accounttype
$accounttype
contains the account type
$amountoutstanding
contains the $amountoutstanding
$timestamp
contains the timestamp with time and the date of the day
$notify_id
contains the file number
$level
contains the file level
() = &UpdateAccountLines($notify_id,$notify_level,$borrowernumber,$itemnumber);
update the account lines with file number or with file level
$items
is a reference-to-hash whose keys are all of the fields from the items tables of the Koha database. Thus,
$itemnumber
contains the item number
$notify_id
contains the file number
$notify_level
contains the file level
$borrowernumber
contains the borrowernumber
($items) = &GetItems($itemnumber);
Returns the list of all delays from overduerules.
$items
is a reference-to-hash whose keys are all of the fields from the items tables of the Koha database. Thus,
$itemnumber
contains the borrower categorycode
(@delays) = &GetOverdueDelays($categorycode);
Returns the list of all delays from overduerules.
@delays
it's an array contains the three delays from overduerules table
$categorycode
contains the borrower categorycode
($exist) = &CheckAccountLineLevelInfo($borrowernumber,$itemnumber,$accounttype,notify_level);
Check and Returns the list of all overdue books.
$exist
contains number of line in accounlines with the same .biblionumber,itemnumber,accounttype,and notify_level
$borrowernumber
contains the borrower number
$itemnumber
contains item number
$accounttype
contains account type
$notify_level
contains the accountline level
($overduerules) = &GetOverduerules($categorycode);
Returns the value of borrowers (debarred or not) with notify level
$overduerules
return value of debbraed field in overduerules table
$category
contains the borrower categorycode
$notify_level
contains the notify level
($debarredstatus) = &CheckBorrowerDebarred($borrowernumber);
Check if the borrowers is already debarred
$debarredstatus
return 0 for not debarred and return 1 for debarred
$borrowernumber
contains the borrower number
($borrowerstatut) = &UpdateBorrowerDebarred($borrowernumber);
update status of borrowers in borrowers table (field debarred)
$borrowernumber
borrower number
($exist) = &CheckExistantNotifyid($borrowernumber,$itemnumber,$accounttype,$notify_id);
Check and Returns the notify id if exist else return 0.
$exist
contains a notify_id
$borrowernumber
contains the borrower number
$date_due
contains the date of item return
($exist) = &CheckAccountLineItemInfo($borrowernumber,$itemnumber,$accounttype,$notify_id);
Check and Returns the list of all overdue items from the same file number(notify_id).
$exist
contains number of line in accounlines with the same .biblionumber,itemnumber,accounttype,notify_id
$borrowernumber
contains the borrower number
$itemnumber
contains item number
$accounttype
contains account type
$notify_id
contains the file number
Sql request to check if the document has alreday been notified this function is not exported, only used with GetOverduesForBranch
Sql request for display all information for branchoverdues.pl 2 possibilities : with or without location . display is filtered by branch
&AddNotifyLine($borrowernumber, $itemnumber, $overduelevel, $method, $notifyId)
Creat a line into notify, if the method is phone, the notification_send_date is implemented to
&RemoveNotifyLine( $borrowernumber, $itemnumber, $notify_date );
Cancel a notification
Koha Developement team <info@koha.org>
Hey! The above document had some coding errors, which are explained below:
You forgot a '=back' before '=head2'
'=item' outside of any '=over'
You forgot a '=back' before '=head2'
=back without =over