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)
committerTomas Cohen Arazi <tomascohen@gmail.com>
Fri, 10 Apr 2015 13:19:24 +0000 (10:19 -0300)
commit4094a235def0fb268720f3d3b4ae6d9ea1e9ddfc
treee59013bed3fe7c4fbc077c87f2bad8692b83cbfe
parenteab9af7ee7344c4fd5a09202cb8b9415d0e7f9e5
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>
C4/Circulation.pm
C4/Overdues.pm