<<

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, $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 three values:

$amount is the fine owed by the patron (see above).

$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

    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(
        {
            issue_id       => $issue_id,
            itemnumber     => $itemnumber,
            borrowernumber => $borrowernumber,
            amount         => $amount,
            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.

$due is the date

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

GetFine

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

return the total of fine

$itemnum is item number

$borrowernumber is the borrowernumber

GetBranchcodesWithOverdueRules

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

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

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.

GetOverdueMessageTransportTypes

    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)

parse_overdues_letter

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.

AUTHOR

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

<<