Bug 13958: Use SuspensionsCalendar syspref for more granularity

This patch makes the calculation of suspension expiration configuration
detached from the finesCalendar syspref. This way libraries have more
flexibility when setting circ rules.

I wrote this path as a bugfix, because the recent change pushed by bug 19204
changed this behavior and libraries have been complaining since they got
upgraded.

It is a minor change, just adding the new syspref, and replacing the
single place in which it is used for debarment calculation for the new
one.

The tests are updated similarly, just adding the new mocked syspref as
it was with the old one.

To test:
- Apply this patches
- updatedatabase
- Run:
  $ kshell
 k$ prove t/db_dependent/Circulation.t
=> SUCCESS: Tests pass!
- Sign off :-D

Sponsored-by: Universidad Nacional de Córdoba
Signed-off-by: Michal Denar <black23@gmail.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
(cherry picked from commit f59a34a9ca)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
This commit is contained in:
Tomas Cohen Arazi 2019-05-27 12:10:57 -03:00 committed by Lucas Gass
parent b0c17be0f4
commit ee600debe4
2 changed files with 2 additions and 1 deletions

View File

@ -2277,7 +2277,7 @@ sub _debar_user_on_return {
my $new_debar_dt;
# Use the calendar or not to calculate the debarment date
if ( C4::Context->preference('finesCalendar') eq 'noFinesWhenClosed' ) {
if ( C4::Context->preference('SuspensionsCalendar') eq 'noSuspensionsWhenClosed' ) {
my $calendar = Koha::Calendar->new(
branchcode => $branchcode,
days_mode => 'Calendar'

View File

@ -1854,6 +1854,7 @@ subtest 'AddReturn + suspension_chargeperiod' => sub {
$rule->suspension_chargeperiod(1)->store;
$rule->firstremind(0)->store;
t::lib::Mocks::mock_preference('finesCalendar', 'noFinesWhenClosed');
t::lib::Mocks::mock_preference('SuspensionsCalendar', 'noSuspensionsWhenClosed');
# Adding a holiday 2 days ago
my $calendar = C4::Calendar->new(branchcode => $library->{branchcode});