<<

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();

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, $dbh );

Not exported

CalcFine
  ($amount, $chargename, $message) =
    &CalcFine($itemnumber, $borrowercode, $days_overdue);

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

The fine is calculated as follows: if it is time for the first reminder, the fine is the value listed for the given (branch, item type, borrower code) combination. If it is time for the second reminder, the fine is doubled. Finally, if it is time to send the account to a collection agency, the fine is set to 5 local monetary units (a really good deal for the patron if the library is in Italy). Otherwise, the fine is 0.

Note that the way this function is currently implemented, it only returns a nonzero value on the notable days listed above. That is, if the categoryitems entry says to send a first reminder 7 days after the book is due, then if you call &CalcFine 7 days after the book is due, it will give a nonzero fine. If you call &CalcFine the next day, however, it will say that the fine is 0.

$itemnumber is the book's item number.

$borrowercode is the borrower code of the patron who currently has the book.

$days_overdue is the number of days elapsed since the book's due date.

&CalcFine returns a list of three 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.

$message is a text message, either "First Notice", "Second Notice", or "Final Notice".

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.

ReplacementCost
  $cost = &ReplacementCost($itemnumber);

Returns the replacement cost of the item with the given item number.

GetFine

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

return the total of fine

$itemnum is item number

$borrowernumber is the borrowernumber

GetIssuingRules

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

GetNextIdNotify

($result) = &GetNextIdNotify($reference);

Returns the new file number

$result contains the next file number

$reference contains the beggining of file number

AmountNotify

(@notify) = &AmountNotify($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 nad item number

GetNotifyId

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

() = &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

() = &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

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

GetOverdueDelays

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

CheckAccountLineLevelInfo

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

GetOverduerules

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

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

UpdateBorrowerDebarred

($borrowerstatut) = &UpdateBorrowerDebarred($borrowernumber);

update status of borrowers in borrowers table (field debarred)

$borrowernumber borrower number

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

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

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

AddNotifyLine

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

Creat 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 Developement team <info@koha.org>

POD ERRORS

Hey! The above document had some coding errors, which are explained below:

Around line 143:

You forgot a '=back' before '=head2'

Around line 179:

'=item' outside of any '=over'

Around line 1121:

You forgot a '=back' before '=head2'

Around line 1318:

=back without =over

<<