<<

NAME

C4::Circulation::Fines - Koha module dealing with fines

SYNOPSIS

  use C4::Overdues;

DESCRIPTION

This module contains several functions for dealing with fines for overdue items. It is primarily used by the 'misc/fines2.pl' script.

FUNCTIONS

Getoverdues

  $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.

checkoverdues

    ($count, $overdueitems) = checkoverdues($borrowernumber);

Returns a count and a list of overdueitems for a given borrowernumber

CalcFine

    ($amount, $chargename,  $daycounttotal) = &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.

$unitcount is the number of chargeable units (days between start and end dates, Calendar adjusted where needed, minus any applicable grace period, or hours)

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.

_get_chargeable_units

    _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

    &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

    &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

GetWayFromItemnumber

    &Getwdayfromitemnumber($itemnumber);

return the different week day from repeatable_holidays table

$itemnumber is item number.

GetIssuesIteminfo

    &GetIssuesIteminfo($itemnumber);

return all data from issues about item

$itemnumber is item number.

UpdateFine

    &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.

BorType

    $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.

GetFine

    $data->{'sum(amountoutstanding)'} = &GetFine($itemnum,$borrowernumber);

return the total of fine

$itemnum is item number

$borrowernumber is the borrowernumber

NumberNotifyId

    (@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

AmountNotify

    ($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

GetItems

    ($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

GetBranchcodesWithOverdueRules

    my @branchcodes = C4::Overdues::GetBranchcodesWithOverdueRules()

returns a list of branch codes for branches with overdue rules defined.

CheckBorrowerDebarred

    ($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

CheckItemNotify

Sql request to check if the document has alreday been notified this function is not exported, only used with GetOverduesForBranch

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

    &AddNotifyLine($borrowernumber, $itemnumber, $overduelevel, $method, $notifyId)

Create a line into notify, if the method is phone, the notification_send_date is implemented to

RemoveNotifyLine

    &RemoveNotifyLine( $borrowernumber, $itemnumber, $notify_date );

Cancel a notification

AUTHOR

Koha Development Team <http://koha-community.org/>

<<