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);
Returns a count and a list of overdueitems for a given borrowernumber
($amount, $chargename, $units_minus_grace, $chargeable_units) = &CalcFine($item, $categorycode, $branch, $start_dt, $end_dt );
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.
$start_date
& $end_date
are DateTime objects defining the date range over which to determine the fine.
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.
$units_minus_grace
is the number of chargeable units minus the grace period
$chargeable_units
is the number of chargeable units (days between start and end dates, Calendar adjusted where needed, minus any applicable grace period, or hours)
FIXME: previously attempted to return $message
as a text message, either "First Notice", "Second Notice", or "Final Notice". But CalcFine never defined any value.
get_chargeable_units($unit, $start_date_ $end_date, $branchcode);
return integer value of units between $start_date
and $end_date
, factoring in holidays for $branchcode
.
$unit
is 'days' or 'hours' (default is 'days').
$start_date
and $end_date
are the two DateTimes to get the number of units between.
$branchcode
is the branch whose calendar to use for finding holidays.
&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({ issue_id => $issue_id, itemnumber => $itemnumber, borrwernumber => $borrowernumber, amount => $amount, type => $type, $due => $date_due });
(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.
$due
is the due date formatted to the currently specified date 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 they belong to.
$data->{'sum(amountoutstanding)'} = &GetFine($itemnum,$borrowernumber);
return the total of fine
$itemnum
is item number
$borrowernumber
is the borrowernumber
(@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
($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
my @branchcodes = C4::Overdues::GetBranchcodesWithOverdueRules()
returns a list of branch codes for branches with overdue rules defined.
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
FIXME: This function should be renamed.
&AddNotifyLine($borrowernumber, $itemnumber, $overduelevel, $method, $notifyId)
Create a line into notify, if the method is phone, the notification_send_date is implemented to
&RemoveNotifyLine( $borrowernumber, $itemnumber, $notify_date );
Cancel a notification
my $message_transport_types = GetOverdueMessageTransportTypes( $branchcode, $categorycode, $letternumber); return a arrayref with all message_transport_type for given branchcode, categorycode and letternumber(1,2 or 3)
parses the letter template, replacing the placeholders with data specific to this patron, biblio, or item for overdues
named parameters: letter - required hashref borrowernumber - required integer substitute - optional hashref of other key/value pairs that should be substituted in the letter content
returns the letter
hashref, with the content updated to reflect the substituted keys and values.
Koha Development Team <http://koha-community.org/>