Bug 24138: Fix calculation of suspension days when a limit is set
authorJonathan Druart <jonathan.druart@bugs.koha-community.org>
Fri, 29 Nov 2019 13:45:25 +0000 (14:45 +0100)
committerJoy Nelson <joy@bywatersolutions.com>
Thu, 19 Dec 2019 21:51:17 +0000 (21:51 +0000)
commit17eabbf4bf4b48f0ff938f3ac05bcbe40f5970d2
tree42409761c3edbaf4b1d7db76a4f971b33912d4ce
parent1bf0904d2817c250ec7ef70667c7631e4f24d12f
Bug 24138: Fix calculation of suspension days when a limit is set

If there is a limit for the number of suspension days
(maxsuspensiondays), the calculation is wrong. We are reducing the
number of days before taking into account the suspension charging
interval.

For instance, a checkin is 1 year late and the circ rules are defined to
charge 7 days every 15 days.
It results in 365 * 7 / 15 days of suspension => 170 days

Before this patch the calculation was:
365 * 7 limited to 333, 333 / 15 => 22 days

Test plan:
Given the examples in the commit messages and the description of the bug
report, setup complex circulation rules and confirm that the debarment
dates are calculated correctly

Signed-off-by: Hugo Agud <hagud@orex.es>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Joy Nelson <joy@bywatersolutions.com>
C4/Circulation.pm
t/db_dependent/Circulation/IssuingRules/maxsuspensiondays.t