Bug 13909: Suspension days calculation should respect finesCalendar
authorTomas Cohen Arazi <tomascohen@gmail.com>
Fri, 27 Mar 2015 17:32:35 +0000 (14:32 -0300)
committerChris Cormack <chris@bigballofwax.co.nz>
Mon, 20 Apr 2015 10:15:53 +0000 (22:15 +1200)
commit463e17f71480d5580e7c3e4abe44a380e9bb3483
tree0a793cd375d8beb91925a02eb37023e40a69a12f
parentef5c2cda9a60b362a9139be9c4298369e4f687f4
Bug 13909: Suspension days calculation should respect finesCalendar

This patch make _debar_user_on_return respect the finesCalendar syspref.

It does so, by replacing the ad-hoc overdue days calculation in favor of
C4::Overdues::_get_chargeable_units (which is renamed C4::Overdues::get_chargeable_units
and exported). There's no behaviour change besides making the calculation simpler
and correct.

To test:
- Set finesCalendar = "directly"
- Have a circulation rule stating:
  interval for calculating fines = 1
  suspension days = 3
- Have the calendar set for sunday and saturday as holidays.
- Checkout an item with a branch/itype/borrower category that matches the defined circ rule with a hand-writen due date to (say) last friday.
- Check the item in
=> FAIL: Notice that the user is debarred using the calendar (skipping saturday and sunday).
- Apply the patch
- Repeat the previous steps
=> SUCCESS: calculation is correct (counting saturday and sunday as overdue days, i.e. 'directly').
- Set finesCalendar = "calendar"
- Repeat the test
=> SUCCESS: calculation is correct (skipping holidays).
- Sign off.

Sponsored-by: Universidad Nacional de Cordoba
Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
(cherry picked from commit 4094a235def0fb268720f3d3b4ae6d9ea1e9ddfc)
Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>
C4/Circulation.pm
C4/Overdues.pm