View | Details | Raw Unified | Return to bug 18936
Collapse All | Expand All

(-)a/C4/Reserves.pm (-1 / +1 lines)
Lines 1218-1224 sub IsAvailableForItemLevelRequest { Link Here
1218
        $item->withdrawn        ||
1218
        $item->withdrawn        ||
1219
        ($item->damaged && !C4::Context->preference('AllowHoldsOnDamagedItems'));
1219
        ($item->damaged && !C4::Context->preference('AllowHoldsOnDamagedItems'));
1220
1220
1221
    my $on_shelf_holds = Koha::IssuingRules->get_onshelfholds_policy( { item => $item, patron => $patron } );
1221
    my $on_shelf_holds = Koha::CirculationRules->get_onshelfholds_policy( { item => $item, patron => $patron } );
1222
1222
1223
    if ($pickup_branchcode) {
1223
    if ($pickup_branchcode) {
1224
        my $destination = Koha::Libraries->find($pickup_branchcode);
1224
        my $destination = Koha::Libraries->find($pickup_branchcode);
(-)a/Koha/Charges/Fees.pm (-6 / +6 lines)
Lines 22-28 use Modern::Perl; Link Here
22
use Carp qw( carp confess );
22
use Carp qw( carp confess );
23
23
24
use Koha::Calendar;
24
use Koha::Calendar;
25
use Koha::IssuingRules;
26
use Koha::DateUtils qw( dt_from_string );
25
use Koha::DateUtils qw( dt_from_string );
27
use Koha::Exceptions;
26
use Koha::Exceptions;
28
27
Lines 90-106 sub new { Link Here
90
sub accumulate_rentalcharge {
89
sub accumulate_rentalcharge {
91
    my ($self) = @_;
90
    my ($self) = @_;
92
91
93
    my $itemtype     = Koha::ItemTypes->find( $self->item->effective_itemtype );
92
    my $itemtype        = Koha::ItemTypes->find( $self->item->effective_itemtype );
94
    my $issuing_rule = Koha::IssuingRules->get_effective_issuing_rule(
93
    my $lengthunit_rule = Koha::CirculationRules->get_effective_rule(
95
        {
94
        {
96
            categorycode => $self->patron->categorycode,
95
            categorycode => $self->patron->categorycode,
97
            itemtype     => $itemtype->id,
96
            itemtype     => $itemtype->id,
98
            branchcode   => $self->library->id
97
            branchcode   => $self->library->id,
98
            rule_name    => 'lengthunit',
99
        }
99
        }
100
    );
100
    );
101
    return 0 unless $issuing_rule;
101
    return 0 unless $lengthunit_rule;
102
102
103
    my $units = $issuing_rule->lengthunit;
103
    my $units = $lengthunit_rule->rule_value;
104
    my $rentalcharge_increment =
104
    my $rentalcharge_increment =
105
      ( $units eq 'days' )
105
      ( $units eq 'days' )
106
      ? $itemtype->rentalcharge_daily
106
      ? $itemtype->rentalcharge_daily
(-)a/Koha/CirculationRules.pm (-2 / +6 lines)
Lines 154-159 our $RULE_KINDS = { Link Here
154
    suspension_chargeperiod => {
154
    suspension_chargeperiod => {
155
        scope => [ 'branchcode', 'categorycode', 'itemtype' ],
155
        scope => [ 'branchcode', 'categorycode', 'itemtype' ],
156
    },
156
    },
157
    note => { # This is not really a rule. Maybe we will want to separate this later.
158
        scope => [ 'branchcode', 'categorycode', 'itemtype' ],
159
    },
157
    # Not included (deprecated?):
160
    # Not included (deprecated?):
158
    #   * accountsent
161
    #   * accountsent
159
    #   * reservecharge
162
    #   * reservecharge
Lines 180-187 sub get_effective_rule { Link Here
180
    my $itemtype     = $params->{itemtype};
183
    my $itemtype     = $params->{itemtype};
181
    my $branchcode   = $params->{branchcode};
184
    my $branchcode   = $params->{branchcode};
182
185
186
    my @c = caller;
183
    Koha::Exceptions::MissingParameter->throw(
187
    Koha::Exceptions::MissingParameter->throw(
184
        "Required parameter 'rule_name' missing")
188
        "Required parameter 'rule_name' missing" . "@c")
185
      unless $rule_name;
189
      unless $rule_name;
186
190
187
    for my $v ( $branchcode, $categorycode, $itemtype ) {
191
    for my $v ( $branchcode, $categorycode, $itemtype ) {
Lines 372-378 sub get_opacitemholds_policy { Link Here
372
376
373
    return unless $item or $patron;
377
    return unless $item or $patron;
374
378
375
    my $rule = Koha::CirculationRules->get_effective_issuing_rule(
379
    my $rule = Koha::CirculationRules->get_effective_rule(
376
        {
380
        {
377
            categorycode => $patron->categorycode,
381
            categorycode => $patron->categorycode,
378
            itemtype     => $item->effective_itemtype,
382
            itemtype     => $item->effective_itemtype,
(-)a/Koha/REST/V1/Checkouts.pm (-2 / +1 lines)
Lines 24-30 use C4::Auth qw( haspermission ); Link Here
24
use C4::Context;
24
use C4::Context;
25
use C4::Circulation;
25
use C4::Circulation;
26
use Koha::Checkouts;
26
use Koha::Checkouts;
27
use Koha::IssuingRules;
28
use Koha::Old::Checkouts;
27
use Koha::Old::Checkouts;
29
28
30
use Try::Tiny;
29
use Try::Tiny;
Lines 209-215 sub allows_renewal { Link Here
209
    my $renewable = Mojo::JSON->false;
208
    my $renewable = Mojo::JSON->false;
210
    $renewable = Mojo::JSON->true if $can_renew;
209
    $renewable = Mojo::JSON->true if $can_renew;
211
210
212
    my $rule = Koha::IssuingRules->get_effective_issuing_rule(
211
    my $rule = Koha::CirculationRules->get_effective_rule(
213
        {
212
        {
214
            categorycode => $checkout->patron->categorycode,
213
            categorycode => $checkout->patron->categorycode,
215
            itemtype     => $checkout->item->effective_itemtype,
214
            itemtype     => $checkout->item->effective_itemtype,
(-)a/admin/smart-rules.pl (-10 / +12 lines)
Lines 85-99 if ($op eq 'delete') { Link Here
85
            branchcode   => $branch eq '*' ? undef : $branch,
85
            branchcode   => $branch eq '*' ? undef : $branch,
86
            itemtype     => $itemtype eq '*' ? undef : $itemtype,
86
            itemtype     => $itemtype eq '*' ? undef : $itemtype,
87
            rules        => {
87
            rules        => {
88
                restrictedtype                   => undef,
88
                maxissueqty                      => undef,
89
                maxonsiteissueqty                => undef,
89
                rentaldiscount                   => undef,
90
                rentaldiscount                   => undef,
90
                fine                             => undef,
91
                fine                             => undef,
91
                finedays                         => undef,
92
                finedays                         => undef,
92
                maxsuspensiondays                => undef,
93
                maxsuspensiondays                => undef,
94
                suspension_chargeperiod          => undef,
93
                firstremind                      => undef,
95
                firstremind                      => undef,
94
                chargeperiod                     => undef,
96
                chargeperiod                     => undef,
95
                chargeperiod_charge_at           => undef,
97
                chargeperiod_charge_at           => undef,
96
                accountsent                      => undef,
97
                issuelength                      => undef,
98
                issuelength                      => undef,
98
                lengthunit                       => undef,
99
                lengthunit                       => undef,
99
                hardduedate                      => undef,
100
                hardduedate                      => undef,
Lines 106-116 if ($op eq 'delete') { Link Here
106
                no_auto_renewal_after_hard_limit => undef,
107
                no_auto_renewal_after_hard_limit => undef,
107
                reservesallowed                  => undef,
108
                reservesallowed                  => undef,
108
                holds_per_record                 => undef,
109
                holds_per_record                 => undef,
109
                overduefinescap                  => undef,
110
                holds_per_day                    => undef,
110
                cap_fine_to_replacement_price    => undef,
111
                onshelfholds                     => undef,
111
                onshelfholds                     => undef,
112
                opacitemholds                    => undef,
112
                opacitemholds                    => undef,
113
                overduefinescap                  => undef,
114
                cap_fine_to_replacement_price    => undef,
113
                article_requests                 => undef,
115
                article_requests                 => undef,
116
                note                             => undef,
114
            }
117
            }
115
        }
118
        }
116
    );
119
    );
Lines 298-303 elsif ($op eq 'add') { Link Here
298
    my $rules = {
301
    my $rules = {
299
        maxissueqty                   => $maxissueqty,
302
        maxissueqty                   => $maxissueqty,
300
        maxonsiteissueqty             => $maxonsiteissueqty,
303
        maxonsiteissueqty             => $maxonsiteissueqty,
304
        rentaldiscount                => $rentaldiscount,
301
        fine                          => $fine,
305
        fine                          => $fine,
302
        finedays                      => $finedays,
306
        finedays                      => $finedays,
303
        maxsuspensiondays             => $maxsuspensiondays,
307
        maxsuspensiondays             => $maxsuspensiondays,
Lines 305-310 elsif ($op eq 'add') { Link Here
305
        firstremind                   => $firstremind,
309
        firstremind                   => $firstremind,
306
        chargeperiod                  => $chargeperiod,
310
        chargeperiod                  => $chargeperiod,
307
        chargeperiod_charge_at        => $chargeperiod_charge_at,
311
        chargeperiod_charge_at        => $chargeperiod_charge_at,
312
        issuelength                   => $issuelength,
313
        lengthunit                    => $lengthunit,
314
        hardduedate                   => $hardduedate,
315
        hardduedatecompare            => $hardduedatecompare,
308
        renewalsallowed               => $renewalsallowed,
316
        renewalsallowed               => $renewalsallowed,
309
        renewalperiod                 => $renewalperiod,
317
        renewalperiod                 => $renewalperiod,
310
        norenewalbefore               => $norenewalbefore,
318
        norenewalbefore               => $norenewalbefore,
Lines 314-324 elsif ($op eq 'add') { Link Here
314
        reservesallowed               => $reservesallowed,
322
        reservesallowed               => $reservesallowed,
315
        holds_per_record              => $holds_per_record,
323
        holds_per_record              => $holds_per_record,
316
        holds_per_day                 => $holds_per_day,
324
        holds_per_day                 => $holds_per_day,
317
        issuelength                   => $issuelength,
318
        lengthunit                    => $lengthunit,
319
        hardduedate                   => $hardduedate,
320
        hardduedatecompare            => $hardduedatecompare,
321
        rentaldiscount                => $rentaldiscount,
322
        onshelfholds                  => $onshelfholds,
325
        onshelfholds                  => $onshelfholds,
323
        opacitemholds                 => $opacitemholds,
326
        opacitemholds                 => $opacitemholds,
324
        overduefinescap               => $overduefinescap,
327
        overduefinescap               => $overduefinescap,
Lines 403-409 elsif ($op eq "set-branch-defaults") { Link Here
403
        {
406
        {
404
            branchcode   => $branch,
407
            branchcode   => $branch,
405
            categorycode => undef,
408
            categorycode => undef,
406
            itemtype     => undef,
407
            rule_name    => 'max_holds',
409
            rule_name    => 'max_holds',
408
            rule_value   => $max_holds,
410
            rule_value   => $max_holds,
409
        }
411
        }
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/smart-rules.tt (-35 / +32 lines)
Lines 124-163 Link Here
124
                [% SET row_count = 0 %]
124
                [% SET row_count = 0 %]
125
                [% FOREACH c IN categorycodes %]
125
                [% FOREACH c IN categorycodes %]
126
                    [% FOREACH i IN itemtypes %]
126
                    [% FOREACH i IN itemtypes %]
127
                        [% SET note = CirculationRules.Get( branchcode, c, i, 'note' ) %]
127
                        [% SET note = CirculationRules.Search( branchcode, c, i, 'note' ) %]
128
                        [% SET maxissueqty = CirculationRules.Get( branchcode, c, i, 'maxissueqty' ) %]
128
                        [% SET maxissueqty = CirculationRules.Search( branchcode, c, i, 'maxissueqty' ) %]
129
                        [% SET maxonsiteissueqty = CirculationRules.Get( branchcode, c, i, 'maxonsiteissueqty' ) %]
129
                        [% SET maxonsiteissueqty = CirculationRules.Search( branchcode, c, i, 'maxonsiteissueqty' ) %]
130
                        [% SET issuelength = CirculationRules.Get( branchcode, c, i, 'issuelength' ) %]
130
                        [% SET issuelength = CirculationRules.Search( branchcode, c, i, 'issuelength' ) %]
131
                        [% SET lengthunit = CirculationRules.Get( branchcode, c, i, 'lengthunit' ) %]
131
                        [% SET lengthunit = CirculationRules.Search( branchcode, c, i, 'lengthunit' ) %]
132
                        [% SET hardduedate = CirculationRules.Get( branchcode, c, i, 'hardduedate' ) %]
132
                        [% SET hardduedate = CirculationRules.Search( branchcode, c, i, 'hardduedate' ) %]
133
                        [% SET hardduedatecompare = CirculationRules.Get( branchcode, c, i, 'hardduedatecompare' ) %]
133
                        [% SET hardduedatecompare = CirculationRules.Search( branchcode, c, i, 'hardduedatecompare' ) %]
134
                        [% SET fine = CirculationRules.Get( branchcode, c, i, 'fine' ) %]
134
                        [% SET fine = CirculationRules.Search( branchcode, c, i, 'fine' ) %]
135
                        [% SET chargeperiod = CirculationRules.Get( branchcode, c, i, 'chargeperiod' ) %]
135
                        [% SET chargeperiod = CirculationRules.Search( branchcode, c, i, 'chargeperiod' ) %]
136
                        [% SET chargeperiod_charge_at = CirculationRules.Get( branchcode, c, i, 'chargeperiod_charge_at' ) %]
136
                        [% SET chargeperiod_charge_at = CirculationRules.Search( branchcode, c, i, 'chargeperiod_charge_at' ) %]
137
                        [% SET firstremind = CirculationRules.Get( branchcode, c, i, 'firstremind' ) %]
137
                        [% SET firstremind = CirculationRules.Search( branchcode, c, i, 'firstremind' ) %]
138
                        [% SET overduefinescap = CirculationRules.Get( branchcode, c, i, 'overduefinescap' ) %]
138
                        [% SET overduefinescap = CirculationRules.Search( branchcode, c, i, 'overduefinescap' ) %]
139
                        [% SET cap_fine_to_replacement_price = CirculationRules.Get( branchcode, c, i, 'cap_fine_to_replacement_price' ) %]
139
                        [% SET cap_fine_to_replacement_price = CirculationRules.Search( branchcode, c, i, 'cap_fine_to_replacement_price' ) %]
140
                        [% SET finedays = CirculationRules.Get( branchcode, c, i, 'finedays' ) %]
140
                        [% SET finedays = CirculationRules.Search( branchcode, c, i, 'finedays' ) %]
141
                        [% SET maxsuspensiondays = CirculationRules.Get( branchcode, c, i, 'maxsuspensiondays' ) %]
141
                        [% SET maxsuspensiondays = CirculationRules.Search( branchcode, c, i, 'maxsuspensiondays' ) %]
142
                        [% SET suspension_chargeperiod = CirculationRules.Get( branchcode, c, i, 'suspension_chargeperiod' ) %]
142
                        [% SET suspension_chargeperiod = CirculationRules.Search( branchcode, c, i, 'suspension_chargeperiod' ) %]
143
                        [% SET renewalsallowed = CirculationRules.Get( branchcode, c, i, 'renewalsallowed' ) %]
143
                        [% SET renewalsallowed = CirculationRules.Search( branchcode, c, i, 'renewalsallowed' ) %]
144
                        [% SET renewalperiod = CirculationRules.Get( branchcode, c, i, 'renewalperiod' ) %]
144
                        [% SET renewalperiod = CirculationRules.Search( branchcode, c, i, 'renewalperiod' ) %]
145
                        [% SET norenewalbefore = CirculationRules.Get( branchcode, c, i, 'norenewalbefore' ) %]
145
                        [% SET norenewalbefore = CirculationRules.Search( branchcode, c, i, 'norenewalbefore' ) %]
146
                        [% SET auto_renew = CirculationRules.Get( branchcode, c, i, 'auto_renew' ) %]
146
                        [% SET auto_renew = CirculationRules.Search( branchcode, c, i, 'auto_renew' ) %]
147
                        [% SET no_auto_renewal_after = CirculationRules.Get( branchcode, c, i, 'no_auto_renewal_after' ) %]
147
                        [% SET no_auto_renewal_after = CirculationRules.Search( branchcode, c, i, 'no_auto_renewal_after' ) %]
148
                        [% SET no_auto_renewal_after_hard_limit = CirculationRules.Get( branchcode, c, i, 'no_auto_renewal_after_hard_limit' ) %]
148
                        [% SET no_auto_renewal_after_hard_limit = CirculationRules.Search( branchcode, c, i, 'no_auto_renewal_after_hard_limit' ) %]
149
                        [% SET reservesallowed = CirculationRules.Get( branchcode, c, i, 'reservesallowed' ) %]
149
                        [% SET reservesallowed = CirculationRules.Search( branchcode, c, i, 'reservesallowed' ) %]
150
                        [% SET holds_per_day = CirculationRules.Get( branchcode, c, i, 'holds_per_day' ) %]
150
                        [% SET holds_per_day = CirculationRules.Search( branchcode, c, i, 'holds_per_day' ) %]
151
                        [% SET holds_per_record = CirculationRules.Get( branchcode, c, i, 'holds_per_record' ) %]
151
                        [% SET holds_per_record = CirculationRules.Search( branchcode, c, i, 'holds_per_record' ) %]
152
                        [% SET onshelfholds = CirculationRules.Get( branchcode, c, i, 'onshelfholds' ) %]
152
                        [% SET onshelfholds = CirculationRules.Search( branchcode, c, i, 'onshelfholds' ) %]
153
                        [% SET opacitemholds = CirculationRules.Get( branchcode, c, i, 'opacitemholds' ) %]
153
                        [% SET opacitemholds = CirculationRules.Search( branchcode, c, i, 'opacitemholds' ) %]
154
                        [% SET article_requests = CirculationRules.Get( branchcode, c, i, 'article_requests' ) %]
154
                        [% SET article_requests = CirculationRules.Search( branchcode, c, i, 'article_requests' ) %]
155
                        [% SET rentaldiscount = CirculationRules.Get( branchcode, c, i, 'rentaldiscount' ) %]
155
                        [% SET rentaldiscount = CirculationRules.Search( branchcode, c, i, 'rentaldiscount' ) %]
156
156
157
                        [% SET show_rule = maxissueqty || maxonsiteissueqty || issuelength || lengthunit || hardduedate || hardduedatebefore || hardduedateexact || fine || chargeperiod
157
                        [% SET show_rule = maxissueqty || maxonsiteissueqty || issuelength || lengthunit || hardduedate || hardduedatebefore || hardduedateexact || fine || chargeperiod || chargeperiod_charge_at || firstremind || overduefinescap || cap_fine_to_replacement_price || finedays || maxsuspensiondays || suspension_chargeperiod || renewalsallowed || renewalsallowed || norenewalbefore || auto_renew || no_auto_renewal_after || no_auto_renewal_after_hard_limit || reservesallowed || holds_per_day || holds_per_record || onshelfholds || opacitemholds || article_requests || article_requests %]
158
                                        || chargeperiod_charge_at || firstremind || overduefinescap || cap_fine_to_replacement_price || finedays || maxsuspensiondays || suspension_chargeperiod || renewalsallowed
159
                                        || renewalsallowed || norenewalbefore || auto_renew || no_auto_renewal_after || no_auto_renewal_after_hard_limit || reservesallowed
160
                                        || holds_per_day || holds_per_record || onshelfholds || opacitemholds || article_requests || article_requests %]
161
                        [% IF show_rule %]
158
                        [% IF show_rule %]
162
                            [% SET row_count = row_count + 1 %]
159
                            [% SET row_count = row_count + 1 %]
163
                            <tr row_countd="row_[% row_count %]">
160
                            <tr row_countd="row_[% row_count %]">
Lines 180-187 Link Here
180
                                      <a class="btn btn-default btn-xs delete" href="/cgi-bin/koha/admin/smart-rules.pl?op=delete&amp;itemtype=[% rule.itemtype || '*' %]&amp;categorycode=[% rule.categorycode || '*' %]&amp;branch=[% current_branch %]"><i class="fa fa-trash"></i> Delete</a>
177
                                      <a class="btn btn-default btn-xs delete" href="/cgi-bin/koha/admin/smart-rules.pl?op=delete&amp;itemtype=[% rule.itemtype || '*' %]&amp;categorycode=[% rule.categorycode || '*' %]&amp;branch=[% current_branch %]"><i class="fa fa-trash"></i> Delete</a>
181
                                    </td>
178
                                    </td>
182
                                    <td>
179
                                    <td>
183
                                        [% IF rule.note %]
180
                                        [% IF note.defined %]
184
                                            <a name="viewnote" data-toggle="popover" title="Note" data-content="[% rule.note | html %]" data-placement="top" data-trigger="hover">View note</a>
181
                                            <a name="viewnote" data-toggle="popover" title="Note" data-content="[% note | html %]" data-placement="top" data-trigger="hover">View note</a>
185
                                        [% ELSE %]<span>&nbsp;</span>[% END %]
182
                                        [% ELSE %]<span>&nbsp;</span>[% END %]
186
                                    </td>
183
                                    </td>
187
                                    <td>
184
                                    <td>
(-)a/t/db_dependent/Circulation/CalcFine.t (-7 / +6 lines)
Lines 165-177 subtest 'Test cap_fine_to_replacement_pricew with overduefinescap' => sub { Link Here
165
    plan tests => 2;
165
    plan tests => 2;
166
166
167
    t::lib::Mocks::mock_preference('useDefaultReplacementCost', '1');
167
    t::lib::Mocks::mock_preference('useDefaultReplacementCost', '1');
168
    my $issuingrule = $builder->build_object(
168
    Koha::CirculationRules->set_rules(
169
        {
169
        {
170
            class => 'Koha::IssuingRules',
170
            branchcode   => undef,
171
            value  => {
171
            categorycode => undef,
172
                branchcode                    => '*',
172
            itemtype     => undef,
173
                categorycode                  => '*',
173
            rules        => {
174
                itemtype                      => '*',
175
                fine                          => '1.00',
174
                fine                          => '1.00',
176
                lengthunit                    => 'days',
175
                lengthunit                    => 'days',
177
                finedays                      => 0,
176
                finedays                      => 0,
Lines 198-204 subtest 'Test cap_fine_to_replacement_pricew with overduefinescap' => sub { Link Here
198
    my ($amount) = CalcFine( $item, $patron->{categorycode}, $branch->{branchcode}, $start_dt, $end_dt );
197
    my ($amount) = CalcFine( $item, $patron->{categorycode}, $branch->{branchcode}, $start_dt, $end_dt );
199
    is( int($amount), 3, 'Got the lesser of overduefinescap and replacement price where overduefinescap < replacement price' );
198
    is( int($amount), 3, 'Got the lesser of overduefinescap and replacement price where overduefinescap < replacement price' );
200
199
201
    $issuingrule->overduefinescap(6)->store();
200
    Koha::CirculationRules->set_rule({ rule_name => 'overduefinescap', rule_value => 6, branchcode => undef, categorycode => undef, itemtype => undef });
202
    ($amount) = CalcFine( $item, $patron->{categorycode}, $branch->{branchcode}, $start_dt, $end_dt );
201
    ($amount) = CalcFine( $item, $patron->{categorycode}, $branch->{branchcode}, $start_dt, $end_dt );
203
    is( int($amount), 5, 'Get the lesser of overduefinescap and replacement price where overduefinescap > replacement price' );
202
    is( int($amount), 5, 'Get the lesser of overduefinescap and replacement price where overduefinescap > replacement price' );
204
203
(-)a/t/db_dependent/Circulation/TooMany.t (-8 / +9 lines)
Lines 500-517 subtest 'General vs specific rules limit quantity correctly' => sub { Link Here
500
    });
500
    });
501
501
502
    # Set up an issuing rule
502
    # Set up an issuing rule
503
    my $rule = $builder->build({
503
    Koha::CirculationRules->set_rules(
504
        source => 'Issuingrule',
504
        {
505
        value => {
506
            categorycode => '*',
505
            categorycode => '*',
507
            itemtype     => $itemtype->{itemtype},
506
            itemtype     => $itemtype->{itemtype},
508
            branchcode   => '*',
507
            branchcode   => '*',
509
            issuelength  => 1,
508
            rules        => {
510
            firstremind  => 1,        # 1 day of grace
509
                issuelength => 1,
511
            finedays     => 2,        # 2 days of fine per day of overdue
510
                firstremind => 1,        # 1 day of grace
512
            lengthunit   => 'days',
511
                finedays    => 2,        # 2 days of fine per day of overdue
512
                lengthunit  => 'days',
513
            }
513
        }
514
        }
514
    });
515
    );
515
516
516
    # Set an All->All for an itemtype
517
    # Set an All->All for an itemtype
517
    Koha::CirculationRules->set_rules(
518
    Koha::CirculationRules->set_rules(
(-)a/t/db_dependent/Circulation/issue.t (-9 / +8 lines)
Lines 87-102 my $categorycode = $builder->build({ Link Here
87
    })->{categorycode};
87
    })->{categorycode};
88
88
89
# A default issuingrule should always be present
89
# A default issuingrule should always be present
90
my $issuingrule = $builder->build(
90
Koha::CirculationRules->set_rules(
91
    {
91
    {
92
        source => 'Issuingrule',
92
        itemtype     => '*',
93
        value  => {
93
        categorycode => '*',
94
            itemtype      => '*',
94
        branchcode   => '*',
95
            categorycode  => '*',
95
        rules        => {
96
            branchcode    => '*',
96
            lengthunit      => 'days',
97
            lengthunit    => 'days',
97
            issuelength     => 0,
98
            issuelength   => 0,
98
            renewalperiod   => 0,
99
            renewalperiod => 0,
100
            renewalsallowed => 0
99
            renewalsallowed => 0
101
        }
100
        }
102
    }
101
    }
(-)a/t/db_dependent/Holds.t (-10 / +45 lines)
Lines 460-466 subtest 'Test max_holds per library/patron category' => sub { Link Here
460
    $dbh->do('DELETE FROM reserves');
460
    $dbh->do('DELETE FROM reserves');
461
    $dbh->do('DELETE FROM circulation_rules');
461
    $dbh->do('DELETE FROM circulation_rules');
462
462
463
    $biblio = $builder->build_sample_biblio({ itemtype => 'TEST' });
463
    $biblio = $builder->build_sample_biblio;
464
    ( $item_bibnum, $item_bibitemnum, $itemnumber ) =
464
    ( $item_bibnum, $item_bibitemnum, $itemnumber ) =
465
      AddItem( { homebranch => $branch_1, holdingbranch => $branch_1 },
465
      AddItem( { homebranch => $branch_1, holdingbranch => $branch_1 },
466
        $biblio->biblionumber );
466
        $biblio->biblionumber );
Lines 468-474 subtest 'Test max_holds per library/patron category' => sub { Link Here
468
        {
468
        {
469
            categorycode => undef,
469
            categorycode => undef,
470
            branchcode   => undef,
470
            branchcode   => undef,
471
            itemtype     => $testitemtype,
471
            itemtype     => $biblio->itemtype,
472
            rules        => {
472
            rules        => {
473
                reservesallowed  => 99,
473
                reservesallowed  => 99,
474
                holds_per_record => 99,
474
                holds_per_record => 99,
Lines 535-545 subtest 'Pickup location availability tests' => sub { Link Here
535
    my ( $item_bibnum, $item_bibitemnum, $itemnumber )
535
    my ( $item_bibnum, $item_bibitemnum, $itemnumber )
536
    = AddItem( { homebranch => $branch_1, holdingbranch => $branch_1 }, $biblio->biblionumber );
536
    = AddItem( { homebranch => $branch_1, holdingbranch => $branch_1 }, $biblio->biblionumber );
537
    #Add a default rule to allow some holds
537
    #Add a default rule to allow some holds
538
    $dbh->do(
538
539
        q{INSERT INTO issuingrules (categorycode, branchcode, itemtype, reservesallowed, holds_per_record)
539
    Koha::CirculationRules->set_rules(
540
          VALUES (?, ?, ?, ?, ?)},
540
        {
541
        {},
541
            branchcode   => undef,
542
        '*', '*', '*', 25, 99
542
            categorycode => undef,
543
            itemtype     => undef,
544
            rules        => {
545
                reservesallowed  => 25,
546
                holds_per_record => 99,
547
            }
548
        }
543
    );
549
    );
544
    my $item = Koha::Items->find($itemnumber);
550
    my $item = Koha::Items->find($itemnumber);
545
    my $branch_to = $builder->build({ source => 'Branch' })->{ branchcode };
551
    my $branch_to = $builder->build({ source => 'Branch' })->{ branchcode };
Lines 641-647 subtest 'CanItemBeReserved / holds_per_day tests' => sub { Link Here
641
    );
647
    );
642
648
643
    # Raise reservesallowed to avoid tooManyReserves from it
649
    # Raise reservesallowed to avoid tooManyReserves from it
644
    $issuingrule->set( { reservesallowed => 3 } )->store;
650
    Koha::CirculationRules->set_rule(
651
        {
652
653
            categorycode => '*',
654
            branchcode   => '*',
655
            itemtype     => $itemtype->itemtype,
656
            rule_name  => 'reservesallowed',
657
            rule_value => 3,
658
        }
659
    );
645
660
646
    is_deeply(
661
    is_deeply(
647
        CanItemBeReserved( $patron->borrowernumber, $itemnumber_2 ),
662
        CanItemBeReserved( $patron->borrowernumber, $itemnumber_2 ),
Lines 669-675 subtest 'CanItemBeReserved / holds_per_day tests' => sub { Link Here
669
    );
684
    );
670
685
671
    # Set holds_per_day to 0
686
    # Set holds_per_day to 0
672
    $issuingrule->set( { holds_per_day => 0 } )->store;
687
    Koha::CirculationRules->set_rule(
688
        {
689
690
            categorycode => '*',
691
            branchcode   => '*',
692
            itemtype     => $itemtype->itemtype,
693
            rule_name  => 'holds_per_day',
694
            rule_value => 0,
695
        }
696
    );
697
673
698
674
    # Delete existing holds
699
    # Delete existing holds
675
    Koha::Holds->search->delete;
700
    Koha::Holds->search->delete;
Lines 679-685 subtest 'CanItemBeReserved / holds_per_day tests' => sub { Link Here
679
        'Patron cannot reserve if holds_per_day is 0 (i.e. 0 is 0)'
704
        'Patron cannot reserve if holds_per_day is 0 (i.e. 0 is 0)'
680
    );
705
    );
681
706
682
    $issuingrule->set( { holds_per_day => undef } )->store;
707
    Koha::CirculationRules->set_rule(
708
        {
709
710
            categorycode => '*',
711
            branchcode   => '*',
712
            itemtype     => $itemtype->itemtype,
713
            rule_name  => 'holds_per_day',
714
            rule_value => undef,
715
        }
716
    );
717
683
    Koha::Holds->search->delete;
718
    Koha::Holds->search->delete;
684
    is_deeply(
719
    is_deeply(
685
        CanItemBeReserved( $patron->borrowernumber, $itemnumber_2 ),
720
        CanItemBeReserved( $patron->borrowernumber, $itemnumber_2 ),
(-)a/t/db_dependent/ILSDI_Services.t (-24 / +27 lines)
Lines 379-398 subtest 'Holds test' => sub { Link Here
379
        source => 'Item',
379
        source => 'Item',
380
        value => {
380
        value => {
381
            biblionumber => $biblio2->{biblionumber},
381
            biblionumber => $biblio2->{biblionumber},
382
            damaged => 0
382
            damaged => 0,
383
            itype => $builder->build_object({ class => 'Koha::ItemTypes' })->itemtype,
383
        }
384
        }
384
    });
385
    });
385
386
386
    t::lib::Mocks::mock_preference( 'ReservesControlBranch', 'PatronLibrary' );
387
    t::lib::Mocks::mock_preference( 'ReservesControlBranch', 'PatronLibrary' );
387
    my $issuingrule = $builder->build({
388
    Koha::CirculationRules->set_rule(
388
        source => 'Issuingrule',
389
        {
389
        value => {
390
            categorycode => $patron->{categorycode},
390
            categorycode => $patron->{categorycode},
391
            itemtype => $item2->{itype},
391
            itemtype     => $item2->{itype},
392
            branchcode => $patron->{branchcode},
392
            branchcode   => $patron->{branchcode},
393
            reservesallowed => 0,
393
            rule_name    => 'reservesallowed',
394
            rule_value   => 0,
394
        }
395
        }
395
    });
396
    );
396
397
397
    $query = new CGI;
398
    $query = new CGI;
398
    $query->param( 'patron_id', $patron->{borrowernumber});
399
    $query->param( 'patron_id', $patron->{borrowernumber});
Lines 419-424 subtest 'Holds test' => sub { Link Here
419
        value => {
420
        value => {
420
            biblionumber => $biblio3->{biblionumber},
421
            biblionumber => $biblio3->{biblionumber},
421
            damaged => 0,
422
            damaged => 0,
423
            itype => $builder->build_object({ class => 'Koha::ItemTypes' })->itemtype,
422
        }
424
        }
423
    });
425
    });
424
426
Lines 427-444 subtest 'Holds test' => sub { Link Here
427
        value => {
429
        value => {
428
            biblionumber => $biblio3->{biblionumber},
430
            biblionumber => $biblio3->{biblionumber},
429
            damaged => 1,
431
            damaged => 1,
432
            itype => $builder->build_object({ class => 'Koha::ItemTypes' })->itemtype,
430
        }
433
        }
431
    });
434
    });
432
435
433
    my $issuingrule2 = $builder->build({
436
    Koha::CirculationRules->set_rule(
434
        source => 'Issuingrule',
437
        {
435
        value => {
436
            categorycode => $patron->{categorycode},
438
            categorycode => $patron->{categorycode},
437
            itemtype => $item3->{itype},
439
            itemtype     => $item3->{itype},
438
            branchcode => $patron->{branchcode},
440
            branchcode   => $patron->{branchcode},
439
            reservesallowed => 10,
441
            rule_name    => 'reservesallowed',
442
            rule_value   => 10,
440
        }
443
        }
441
    });
444
    );
442
445
443
    $query = new CGI;
446
    $query = new CGI;
444
    $query->param( 'patron_id', $patron->{borrowernumber});
447
    $query->param( 'patron_id', $patron->{borrowernumber});
Lines 499-517 subtest 'Holds test for branch transfer limits' => sub { Link Here
499
            biblionumber => $biblio->{biblionumber},
502
            biblionumber => $biblio->{biblionumber},
500
            damaged => 0,
503
            damaged => 0,
501
            itemlost => 0,
504
            itemlost => 0,
505
            itype => $builder->build_object({ class => 'Koha::ItemTypes' })->itemtype,
502
        }
506
        }
503
    });
507
    });
504
508
505
    Koha::IssuingRules->search()->delete();
509
    Koha::CirculationRules->set_rule(
506
    my $issuingrule = $builder->build({
510
        {
507
        source => 'Issuingrule',
511
            categorycode => undef,
508
        value => {
512
            itemtype     => undef,
509
            categorycode => '*',
513
            branchcode   => undef,
510
            itemtype => '*',
514
            rule_name    => 'reservesallowed',
511
            branchcode => '*',
515
            rule_value   => 99,
512
            reservesallowed => 99,
513
        }
516
        }
514
    });
517
    );
515
518
516
    my $limit = Koha::Item::Transfer::Limit->new({
519
    my $limit = Koha::Item::Transfer::Limit->new({
517
        toBranch => $pickup_branch->{branchcode},
520
        toBranch => $pickup_branch->{branchcode},
(-)a/t/db_dependent/Koha/IssuingRules.t (-48 / +21 lines)
Lines 19-25 Link Here
19
19
20
use Modern::Perl;
20
use Modern::Perl;
21
21
22
use Test::More tests => 3;
22
use Test::More tests => 2;
23
use Test::Deep qw( cmp_methods );
23
use Test::Deep qw( cmp_methods );
24
use Test::Exception;
24
use Test::Exception;
25
25
Lines 54-59 subtest 'get_effective_issuing_rule' => sub { Link Here
54
            categorycode => undef,
54
            categorycode => undef,
55
            itemtype     => undef,
55
            itemtype     => undef,
56
            rule_name    => 'fine',
56
            rule_name    => 'fine',
57
            rule_value   => 1,
57
        });
58
        });
58
        is($rule, undef, 'When I attempt to get effective issuing rule by'
59
        is($rule, undef, 'When I attempt to get effective issuing rule by'
59
           .' providing undefined values, then undef is returned.');
60
           .' providing undefined values, then undef is returned.');
Lines 62-67 subtest 'get_effective_issuing_rule' => sub { Link Here
62
            categorycode => undef,
63
            categorycode => undef,
63
            itemtype => undef,
64
            itemtype => undef,
64
            rule_name => 'fine',
65
            rule_name => 'fine',
66
            rule_value => 2,
65
        })->store, 'Given I added an issuing rule branchcode => undef,'
67
        })->store, 'Given I added an issuing rule branchcode => undef,'
66
           .' categorycode => undef, itemtype => undef,');
68
           .' categorycode => undef, itemtype => undef,');
67
        $rule = Koha::CirculationRules->get_effective_rule({
69
        $rule = Koha::CirculationRules->get_effective_rule({
Lines 69-74 subtest 'get_effective_issuing_rule' => sub { Link Here
69
            categorycode => undef,
71
            categorycode => undef,
70
            itemtype     => undef,
72
            itemtype     => undef,
71
            rule_name    => 'fine',
73
            rule_name    => 'fine',
74
            rule_value => 3,
72
        });
75
        });
73
        _is_row_match(
76
        _is_row_match(
74
            $rule,
77
            $rule,
Lines 94-99 subtest 'get_effective_issuing_rule' => sub { Link Here
94
            categorycode => $categorycode,
97
            categorycode => $categorycode,
95
            itemtype     => $itemtype,
98
            itemtype     => $itemtype,
96
            rule_name    => 'fine',
99
            rule_name    => 'fine',
100
            rule_value   => 4,
97
        });
101
        });
98
        is($rule, undef, 'When I attempt to get effective issuing rule, then undef'
102
        is($rule, undef, 'When I attempt to get effective issuing rule, then undef'
99
                        .' is returned.');
103
                        .' is returned.');
Lines 103-114 subtest 'get_effective_issuing_rule' => sub { Link Here
103
            categorycode => undef,
107
            categorycode => undef,
104
            itemtype => undef,
108
            itemtype => undef,
105
            rule_name => 'fine',
109
            rule_name => 'fine',
110
            rule_value   => 5,
106
        })->store, 'Given I added an issuing rule branchcode => undef, categorycode => undef, itemtype => undef,');
111
        })->store, 'Given I added an issuing rule branchcode => undef, categorycode => undef, itemtype => undef,');
107
        $rule = Koha::CirculationRules->get_effective_rule({
112
        $rule = Koha::CirculationRules->get_effective_rule({
108
            branchcode   => $branchcode,
113
            branchcode   => $branchcode,
109
            categorycode => $categorycode,
114
            categorycode => $categorycode,
110
            itemtype     => $itemtype,
115
            itemtype     => $itemtype,
111
            rule_name    => 'fine',
116
            rule_name    => 'fine',
117
            rule_value   => 6,
112
        });
118
        });
113
        _is_row_match(
119
        _is_row_match(
114
            $rule,
120
            $rule,
Lines 126-137 subtest 'get_effective_issuing_rule' => sub { Link Here
126
            categorycode => undef,
132
            categorycode => undef,
127
            itemtype => $itemtype,
133
            itemtype => $itemtype,
128
            rule_name => 'fine',
134
            rule_name => 'fine',
135
            rule_value   => 7,
129
        })->store, "Given I added an issuing rule branchcode => undef, categorycode => undef, itemtype => $itemtype,");
136
        })->store, "Given I added an issuing rule branchcode => undef, categorycode => undef, itemtype => $itemtype,");
130
        $rule = Koha::CirculationRules->get_effective_rule({
137
        $rule = Koha::CirculationRules->get_effective_rule({
131
            branchcode   => $branchcode,
138
            branchcode   => $branchcode,
132
            categorycode => $categorycode,
139
            categorycode => $categorycode,
133
            itemtype     => $itemtype,
140
            itemtype     => $itemtype,
134
            rule_name    => 'fine',
141
            rule_name    => 'fine',
142
            rule_value   => 8,
135
        });
143
        });
136
        _is_row_match(
144
        _is_row_match(
137
            $rule,
145
            $rule,
Lines 149-160 subtest 'get_effective_issuing_rule' => sub { Link Here
149
            categorycode => $categorycode,
157
            categorycode => $categorycode,
150
            itemtype => undef,
158
            itemtype => undef,
151
            rule_name => 'fine',
159
            rule_name => 'fine',
160
            rule_value   => 9,
152
        })->store, "Given I added an issuing rule branchcode => undef, categorycode => $categorycode, itemtype => undef,");
161
        })->store, "Given I added an issuing rule branchcode => undef, categorycode => $categorycode, itemtype => undef,");
153
        $rule = Koha::CirculationRules->get_effective_rule({
162
        $rule = Koha::CirculationRules->get_effective_rule({
154
            branchcode   => $branchcode,
163
            branchcode   => $branchcode,
155
            categorycode => $categorycode,
164
            categorycode => $categorycode,
156
            itemtype     => $itemtype,
165
            itemtype     => $itemtype,
157
            rule_name    => 'fine',
166
            rule_name    => 'fine',
167
            rule_value   => 10,
158
        });
168
        });
159
        _is_row_match(
169
        _is_row_match(
160
            $rule,
170
            $rule,
Lines 172-183 subtest 'get_effective_issuing_rule' => sub { Link Here
172
            categorycode => $categorycode,
182
            categorycode => $categorycode,
173
            itemtype => $itemtype,
183
            itemtype => $itemtype,
174
            rule_name => 'fine',
184
            rule_name => 'fine',
185
            rule_value   => 11,
175
        })->store, "Given I added an issuing rule branchcode => undef, categorycode => $categorycode, itemtype => $itemtype,");
186
        })->store, "Given I added an issuing rule branchcode => undef, categorycode => $categorycode, itemtype => $itemtype,");
176
        $rule = Koha::CirculationRules->get_effective_rule({
187
        $rule = Koha::CirculationRules->get_effective_rule({
177
            branchcode   => $branchcode,
188
            branchcode   => $branchcode,
178
            categorycode => $categorycode,
189
            categorycode => $categorycode,
179
            itemtype     => $itemtype,
190
            itemtype     => $itemtype,
180
            rule_name    => 'fine',
191
            rule_name    => 'fine',
192
            rule_value   => 12,
181
        });
193
        });
182
        _is_row_match(
194
        _is_row_match(
183
            $rule,
195
            $rule,
Lines 195-206 subtest 'get_effective_issuing_rule' => sub { Link Here
195
            categorycode => undef,
207
            categorycode => undef,
196
            itemtype => undef,
208
            itemtype => undef,
197
            rule_name => 'fine',
209
            rule_name => 'fine',
210
            rule_value   => 13,
198
        })->store, "Given I added an issuing rule branchcode => $branchcode, categorycode => undef, itemtype => undef,");
211
        })->store, "Given I added an issuing rule branchcode => $branchcode, categorycode => undef, itemtype => undef,");
199
        $rule = Koha::CirculationRules->get_effective_rule({
212
        $rule = Koha::CirculationRules->get_effective_rule({
200
            branchcode   => $branchcode,
213
            branchcode   => $branchcode,
201
            categorycode => $categorycode,
214
            categorycode => $categorycode,
202
            itemtype     => $itemtype,
215
            itemtype     => $itemtype,
203
            rule_name    => 'fine',
216
            rule_name    => 'fine',
217
            rule_value   => 14,
204
        });
218
        });
205
        _is_row_match(
219
        _is_row_match(
206
            $rule,
220
            $rule,
Lines 218-229 subtest 'get_effective_issuing_rule' => sub { Link Here
218
            categorycode => undef,
232
            categorycode => undef,
219
            itemtype => $itemtype,
233
            itemtype => $itemtype,
220
            rule_name => 'fine',
234
            rule_name => 'fine',
235
            rule_value   => 15,
221
        })->store, "Given I added an issuing rule branchcode => $branchcode, categorycode => undef, itemtype => $itemtype,");
236
        })->store, "Given I added an issuing rule branchcode => $branchcode, categorycode => undef, itemtype => $itemtype,");
222
        $rule = Koha::CirculationRules->get_effective_rule({
237
        $rule = Koha::CirculationRules->get_effective_rule({
223
            branchcode   => $branchcode,
238
            branchcode   => $branchcode,
224
            categorycode => $categorycode,
239
            categorycode => $categorycode,
225
            itemtype     => $itemtype,
240
            itemtype     => $itemtype,
226
            rule_name    => 'fine',
241
            rule_name    => 'fine',
242
            rule_value   => 16,
227
        });
243
        });
228
        _is_row_match(
244
        _is_row_match(
229
            $rule,
245
            $rule,
Lines 241-252 subtest 'get_effective_issuing_rule' => sub { Link Here
241
            categorycode => $categorycode,
257
            categorycode => $categorycode,
242
            itemtype => undef,
258
            itemtype => undef,
243
            rule_name => 'fine',
259
            rule_name => 'fine',
260
            rule_value   => 17,
244
        })->store, "Given I added an issuing rule branchcode => $branchcode, categorycode => $categorycode, itemtype => undef,");
261
        })->store, "Given I added an issuing rule branchcode => $branchcode, categorycode => $categorycode, itemtype => undef,");
245
        $rule = Koha::CirculationRules->get_effective_rule({
262
        $rule = Koha::CirculationRules->get_effective_rule({
246
            branchcode   => $branchcode,
263
            branchcode   => $branchcode,
247
            categorycode => $categorycode,
264
            categorycode => $categorycode,
248
            itemtype     => $itemtype,
265
            itemtype     => $itemtype,
249
            rule_name    => 'fine',
266
            rule_name    => 'fine',
267
            rule_value   => 18,
250
        });
268
        });
251
        _is_row_match(
269
        _is_row_match(
252
            $rule,
270
            $rule,
Lines 264-275 subtest 'get_effective_issuing_rule' => sub { Link Here
264
            categorycode => $categorycode,
282
            categorycode => $categorycode,
265
            itemtype => $itemtype,
283
            itemtype => $itemtype,
266
            rule_name => 'fine',
284
            rule_name => 'fine',
285
            rule_value   => 19,
267
        })->store, "Given I added an issuing rule branchcode => $branchcode, categorycode => $categorycode, itemtype => $itemtype,");
286
        })->store, "Given I added an issuing rule branchcode => $branchcode, categorycode => $categorycode, itemtype => $itemtype,");
268
        $rule = Koha::CirculationRules->get_effective_rule({
287
        $rule = Koha::CirculationRules->get_effective_rule({
269
            branchcode   => $branchcode,
288
            branchcode   => $branchcode,
270
            categorycode => $categorycode,
289
            categorycode => $categorycode,
271
            itemtype     => $itemtype,
290
            itemtype     => $itemtype,
272
            rule_name    => 'fine',
291
            rule_name    => 'fine',
292
            rule_value   => 20,
273
        });
293
        });
274
        _is_row_match(
294
        _is_row_match(
275
            $rule,
295
            $rule,
Lines 460-512 subtest 'set_rule' => sub { Link Here
460
    };
480
    };
461
};
481
};
462
482
463
subtest 'delete' => sub {
464
    plan tests => 1;
465
466
    my $itemtype = $builder->build_object({ class => 'Koha::ItemTypes' });
467
    my $library  = $builder->build_object({ class => 'Koha::Libraries' });
468
    my $category = $builder->build_object({ class => 'Koha::Patron::Categories' });
469
470
    # We make an issuing rule
471
    my $issue_rule = $builder->build_object({ class => 'Koha::IssuingRules', value => {
472
            categorycode => $category->categorycode,
473
            itemtype     => $itemtype->itemtype,
474
            branchcode   => $library->branchcode
475
        }
476
    });
477
478
    my $count = Koha::CirculationRules->search()->count;
479
    # Note how many circulation rules we start with
480
481
    # We make some circulation rules for the same thing
482
    $builder->build_object({ class => 'Koha::CirculationRules', value => {
483
            categorycode => $category->categorycode,
484
            itemtype     => $itemtype->itemtype,
485
            branchcode   => $library->branchcode,
486
            rule_name    => 'maxissueqty',
487
        }
488
    });
489
    $builder->build_object({ class => 'Koha::CirculationRules', value => {
490
            categorycode => $category->categorycode,
491
            itemtype     => $itemtype->itemtype,
492
            branchcode   => $library->branchcode,
493
            rule_name    => 'maxonsiteissueqty',
494
        }
495
    });
496
    $builder->build_object({ class => 'Koha::CirculationRules', value => {
497
            categorycode => $category->categorycode,
498
            itemtype     => $itemtype->itemtype,
499
            branchcode   => $library->branchcode,
500
            rule_name    => 'another_rule', # That must not be deleted
501
        }
502
    });
503
504
    # Now we delete the issuing rule
505
    $issue_rule->delete;
506
    is( Koha::CirculationRules->search()->count ,$count +  1, "We remove related circ rules maxissueqty and maxonsiteissueqty with our issuing rule");
507
508
};
509
510
sub _is_row_match {
483
sub _is_row_match {
511
    my ( $rule, $expected, $message ) = @_;
484
    my ( $rule, $expected, $message ) = @_;
512
485
(-)a/t/db_dependent/SIP/Transaction.t (-1 lines)
Lines 16-22 use C4::SIP::ILS::Transaction::FeePayment; Link Here
16
use C4::SIP::ILS::Transaction::Hold;
16
use C4::SIP::ILS::Transaction::Hold;
17
17
18
use C4::Reserves;
18
use C4::Reserves;
19
use Koha::IssuingRules;
20
19
21
my $schema = Koha::Database->new->schema;
20
my $schema = Koha::Database->new->schema;
22
$schema->storage->txn_begin;
21
$schema->storage->txn_begin;
(-)a/t/db_dependent/selenium/administration_tasks.t (-2 / +1 lines)
Lines 84-90 SKIP: { Link Here
84
        $elt = $driver->find_elements('//table[@id="default-circulation-rules"]/tbody/tr/td[contains(text(),"'.$itype->description.'")]/following-sibling::td/span[text() = "Unlimited"]');
84
        $elt = $driver->find_elements('//table[@id="default-circulation-rules"]/tbody/tr/td[contains(text(),"'.$itype->description.'")]/following-sibling::td/span[text() = "Unlimited"]');
85
        is( @$elt,2,"We have unlimited checkouts");
85
        is( @$elt,2,"We have unlimited checkouts");
86
        #Clean up
86
        #Clean up
87
        Koha::IssuingRules->find({itemtype=>$itype->itemtype})->delete();
87
        Koha::CirculationRules->search( { itemtype => $itype->itemtype } )->delete;
88
        $itype->delete;
88
        $itype->delete;
89
               # TODO Create more smart rules navigation here
89
               # TODO Create more smart rules navigation here
90
    };
90
    };
91
- 

Return to bug 18936