Bugzilla – Attachment 94194 Details for
Bug 18936
Move issuingrules into circulation_rules
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 18936: new suspension_chargeperiod
Bug-18936-new-suspensionchargeperiod.patch (text/plain), 4.48 KB, created by
Jonathan Druart
on 2019-10-15 12:33:58 UTC
(
hide
)
Description:
Bug 18936: new suspension_chargeperiod
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2019-10-15 12:33:58 UTC
Size:
4.48 KB
patch
obsolete
>From 13ea009ae9368493e8026a76f7e132ba87047be2 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Thu, 21 Feb 2019 17:49:21 -0300 >Subject: [PATCH] Bug 18936: new suspension_chargeperiod > >--- > C4/Circulation.pm | 5 +++-- > Koha/CirculationRules.pm | 3 +++ > t/db_dependent/Circulation.t | 41 ++++++++++++++++++++++++++++++++++------- > 3 files changed, 40 insertions(+), 9 deletions(-) > >diff --git a/C4/Circulation.pm b/C4/Circulation.pm >index 530815b6e8..cdf41b342f 100644 >--- a/C4/Circulation.pm >+++ b/C4/Circulation.pm >@@ -2248,6 +2248,7 @@ sub _debar_user_on_return { > 'lengthunit', > 'firstremind', > 'maxsuspensiondays', >+ 'suspension_chargeperiod', > ] > } > ); >@@ -2289,10 +2290,10 @@ sub _debar_user_on_return { > } > } > >- if ( $issuing_rule->suspension_chargeperiod > 1 ) { >+ if ( $issuing_rule->{suspension_chargeperiod} > 1 ) { > # No need to / 1 and do not consider / 0 > $suspension_days = DateTime::Duration->new( >- days => floor( $suspension_days->in_units('days') / $issuing_rule->suspension_chargeperiod ) >+ days => floor( $suspension_days->in_units('days') / $issuing_rule->{suspension_chargeperiod} ) > ); > } > >diff --git a/Koha/CirculationRules.pm b/Koha/CirculationRules.pm >index 2f6da8816d..9d38f19a16 100644 >--- a/Koha/CirculationRules.pm >+++ b/Koha/CirculationRules.pm >@@ -148,6 +148,9 @@ our $RULE_KINDS = { > reservesallowed => { > scope => [ 'branchcode', 'categorycode', 'itemtype' ], > }, >+ suspension_chargeperiod => { >+ scope => [ 'branchcode', 'categorycode', 'itemtype' ], >+ }, > # Not included (deprecated?): > # * accountsent > # * reservecharge >diff --git a/t/db_dependent/Circulation.t b/t/db_dependent/Circulation.t >index 287f07687e..2ec5eb23a0 100755 >--- a/t/db_dependent/Circulation.t >+++ b/t/db_dependent/Circulation.t >@@ -2044,7 +2044,16 @@ subtest 'AddReturn + suspension_chargeperiod' => sub { > > # We want to charge 2 days every 2 days, without grace > # With 5 days of overdue: (5 * 2) / 2 >- $rule->suspension_chargeperiod(2)->store; >+ Koha::CirculationRules->set_rule( >+ { >+ categorycode => undef, >+ branchcode => undef, >+ itemtype => undef, >+ rule_name => 'suspension_chargeperiod', >+ rule_value => '2', >+ } >+ ); >+ > $expected_expiration = dt_from_string->add( days => floor( 5 * 2 ) / 2 ); > test_debarment_on_checkout( > { >@@ -2058,8 +2067,17 @@ subtest 'AddReturn + suspension_chargeperiod' => sub { > > # We want to charge 2 days every 3 days, with 1 day of grace > # With 5 days of overdue: ((5-1) / 3 ) * 2 >- $rule->suspension_chargeperiod(3)->store; >- $rule->firstremind(1)->store; >+ Koha::CirculationRules->set_rules( >+ { >+ categorycode => undef, >+ branchcode => undef, >+ itemtype => undef, >+ rules => { >+ suspension_chargeperiod => 3, >+ firstremind => 1, >+ } >+ } >+ ); > $expected_expiration = dt_from_string->add( days => floor( ( ( 5 - 1 ) / 3 ) * 2 ) ); > test_debarment_on_checkout( > { >@@ -2073,9 +2091,18 @@ subtest 'AddReturn + suspension_chargeperiod' => sub { > > # Use finesCalendar to know if holiday must be skipped to calculate the due date > # We want to charge 2 days every days, with 0 day of grace (to not burn brains) >- $rule->finedays(2)->store; >- $rule->suspension_chargeperiod(1)->store; >- $rule->firstremind(0)->store; >+ Koha::CirculationRules->set_rules( >+ { >+ categorycode => undef, >+ branchcode => undef, >+ itemtype => undef, >+ rules => { >+ finedays => 2, >+ suspension_chargeperiod => 1, >+ firstremind => 0, >+ } >+ } >+ ); > t::lib::Mocks::mock_preference('finesCalendar', 'noFinesWhenClosed'); > > # Adding a holiday 2 days ago >@@ -2222,7 +2249,7 @@ subtest 'AddReturn | is_overdue' => sub { > )->unblessed; > > Koha::CirculationRules->search->delete; >- my $rule = Koha::CirculationRules->set_rules( >+ Koha::CirculationRules->set_rules( > { > categorycode => undef, > itemtype => undef, >-- >2.11.0
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 18936
:
65247
|
65248
|
65249
|
67629
|
67758
|
68236
|
71034
|
71035
|
71036
|
71037
|
71038
|
71039
|
71040
|
71041
|
72230
|
72231
|
72232
|
72233
|
72234
|
72235
|
72236
|
72237
|
72238
|
91953
|
91954
|
91955
|
91956
|
91957
|
91958
|
91959
|
91960
|
91961
|
91962
|
91963
|
91964
|
91965
|
91966
|
91967
|
91968
|
91969
|
91970
|
91971
|
91972
|
91973
|
91974
|
91975
|
94179
|
94180
|
94181
|
94182
|
94183
|
94184
|
94185
|
94186
|
94187
|
94188
|
94189
|
94190
|
94191
|
94192
|
94193
|
94194
|
94195
|
94196
|
94197
|
94198
|
94199
|
94200
|
98299
|
98300
|
98301
|
98302
|
98303
|
98304
|
98305
|
98306
|
98307
|
98308
|
98309
|
98310
|
98311
|
98312
|
98313
|
98314
|
98315
|
98316
|
98317
|
98318
|
98319
|
98320
|
98321
|
98322
|
98323
|
98324
|
98325
|
98326
|
98327
|
98328
|
98329
|
98330
|
98331
|
98332
|
98333
|
98334
|
98335
|
98336
|
98337
|
98338
|
98339
|
98340
|
98341
|
98342
|
98343
|
98344
|
98345
|
98346
|
98347
|
98407
|
98408