]> git.koha-community.org Git - koha.git/commit
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)
committerLucas Gass <lucas@bywatersolutions.com>
Fri, 20 Dec 2019 17:13:12 +0000 (17:13 +0000)
commit5ca21e35c66917b4a25d2cacef2518f0dcd6acb0
treea62f20a0b32fa58fd683d8eac40981219a0d9ddf
parent6b25590ea133c0450ff4b28300f61dec05dad003
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>
(cherry picked from commit 17eabbf4bf4b48f0ff938f3ac05bcbe40f5970d2)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
C4/Circulation.pm
t/db_dependent/Circulation/IssuingRules/maxsuspensiondays.t