Fines - roberts-sandbox/create-repo GitHub Wiki
Fines are the post type used to represent the charge (optionally) incurred when an Item on Loan is returned after it was due to be returned.
Created when an item is returned. The Librarian returning the Item is given the option to choose whether to fine the Member to waver the fine. If the Librarian chooses to fine the Member, the fine is calculated as the number of days late X the Library's charge per days late. For example: a book returned on the 5th that was due on the 3rd, at a library where the daily charge is £0.20, would be 2 X £0.20 = £0.40 as the book was returned 2 days after it was due. For security reasons it is not possible for a Librarian to choose how much to fine the Member.
Fines can not be paid individually, and must be paid as quantities of money from the Member management page. Fines do not place any restrictions on a member, but do passively alert a Librarian to a Member's behaviour, as the Member's current Library debt is displayed in the meta box that appears when loaning an item to a member. As a result of this, fines do not have an unpaid or paid status. Member debt is a simple sum of all the member's active fines subtracted by all their fine payments.
Fines charged by accident, or later wavered owing to a profuse apology by the Member involved, may be cancelled. Cancellation removes the fine's amount from the Member's Library debt. If, as a result of payments by the Member, the Member's debt was 0 at time of cancellation then the Member's debt will become negative.
###Post Meta
Fines store information about themselves and foreign keys to connected library objects in their post meta. Below lists all post meta added by WP-Librarian, mandatory unless otherwise noted.
| Meta | Key | Data Type | Description |
|---|---|---|---|
| Item ID | wp_lib_item |
Integer | Post ID of item that was returned late |
| Member ID | wp_lib_member |
Integer | Post ID of member who returned the item late |
| Loan ID | wp_lib_fine |
Integer | Post ID of the loan of item by the member |
| Status | wp_lib_status |
Integer | Current status of the fine (cancelled/not cancelled). [See below](#Fine Status) |
| Owed | wp_lib_owed |
Float | Amount of money the member owes for the late return of the item |
###Loan Status
Fines have two valid states: active and cancelled.
| State | Name | Description |
|---|---|---|
| 0 | N/A | Invalid Status |
| 1 | Active | Currently contributes to member's total amount owed |
| 2 | Cancelled | Does not contribute to member's total amount owed |