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

(-)a/t/db_dependent/Circulation.t (+3 lines)
Lines 680-685 subtest "CanBookBeRenewed tests" => sub { Link Here
680
            categorycode => undef,
680
            categorycode => undef,
681
            branchcode   => undef,
681
            branchcode   => undef,
682
            itemtype     => undef,
682
            itemtype     => undef,
683
            onsite_checkout => undef,
683
            rule_name    => 'norenewalbefore',
684
            rule_name    => 'norenewalbefore',
684
            rule_value   => '7',
685
            rule_value   => '7',
685
        }
686
        }
Lines 2159-2164 subtest 'AddReturn + suspension_chargeperiod' => sub { Link Here
2159
            categorycode => undef,
2160
            categorycode => undef,
2160
            branchcode   => undef,
2161
            branchcode   => undef,
2161
            itemtype     => undef,
2162
            itemtype     => undef,
2163
            onsite_checkout => undef,
2162
            rule_name    => 'suspension_chargeperiod',
2164
            rule_name    => 'suspension_chargeperiod',
2163
            rule_value   => '2',
2165
            rule_value   => '2',
2164
        }
2166
        }
Lines 3438-3443 subtest 'Incremented fee tests' => sub { Link Here
3438
            categorycode => $patron->categorycode,
3440
            categorycode => $patron->categorycode,
3439
            itemtype     => $itemtype->id,
3441
            itemtype     => $itemtype->id,
3440
            branchcode   => $library->id,
3442
            branchcode   => $library->id,
3443
            onsite_checkout => undef,
3441
            rule_name    => 'lengthunit',
3444
            rule_name    => 'lengthunit',
3442
            rule_value   => 'hours',
3445
            rule_value   => 'hours',
3443
        }
3446
        }
(-)a/t/db_dependent/Circulation/CalcFine.t (-1 / +4 lines)
Lines 69-74 subtest 'Test basic functionality' => sub { Link Here
69
            branchcode   => undef,
69
            branchcode   => undef,
70
            categorycode => undef,
70
            categorycode => undef,
71
            itemtype     => undef,
71
            itemtype     => undef,
72
            onsite_checkout => undef,
72
            rules        => {
73
            rules        => {
73
                fine                          => '1.00',
74
                fine                          => '1.00',
74
                lengthunit                    => 'days',
75
                lengthunit                    => 'days',
Lines 109-114 subtest 'Test cap_fine_to_replacement_price' => sub { Link Here
109
            branchcode   => undef,
110
            branchcode   => undef,
110
            categorycode => undef,
111
            categorycode => undef,
111
            itemtype     => undef,
112
            itemtype     => undef,
113
            onsite_checkout => undef,
112
            rules        => {
114
            rules        => {
113
                fine                          => '1.00',
115
                fine                          => '1.00',
114
                lengthunit                    => 'days',
116
                lengthunit                    => 'days',
Lines 162-167 subtest 'Test cap_fine_to_replacement_pricew with overduefinescap' => sub { Link Here
162
            branchcode   => undef,
164
            branchcode   => undef,
163
            categorycode => undef,
165
            categorycode => undef,
164
            itemtype     => undef,
166
            itemtype     => undef,
167
            onsite_checkout => undef,
165
            rules        => {
168
            rules        => {
166
                fine                          => '1.00',
169
                fine                          => '1.00',
167
                lengthunit                    => 'days',
170
                lengthunit                    => 'days',
Lines 189-195 subtest 'Test cap_fine_to_replacement_pricew with overduefinescap' => sub { Link Here
189
    my ($amount) = CalcFine( $item->unblessed, $patron->{categorycode}, $branch->{branchcode}, $start_dt, $end_dt );
192
    my ($amount) = CalcFine( $item->unblessed, $patron->{categorycode}, $branch->{branchcode}, $start_dt, $end_dt );
190
    is( int($amount), 3, 'Got the lesser of overduefinescap and replacement price where overduefinescap < replacement price' );
193
    is( int($amount), 3, 'Got the lesser of overduefinescap and replacement price where overduefinescap < replacement price' );
191
194
192
    Koha::CirculationRules->set_rule({ rule_name => 'overduefinescap', rule_value => 6, branchcode => undef, categorycode => undef, itemtype => undef });
195
    Koha::CirculationRules->set_rule({ rule_name => 'overduefinescap', rule_value => 6, branchcode => undef, onsite_checkout => undef, categorycode => undef, itemtype => undef });
193
    ($amount) = CalcFine( $item->unblessed, $patron->{categorycode}, $branch->{branchcode}, $start_dt, $end_dt );
196
    ($amount) = CalcFine( $item->unblessed, $patron->{categorycode}, $branch->{branchcode}, $start_dt, $end_dt );
194
    is( int($amount), 5, 'Get the lesser of overduefinescap and replacement price where overduefinescap > replacement price' );
197
    is( int($amount), 5, 'Get the lesser of overduefinescap and replacement price where overduefinescap > replacement price' );
195
198
(-)a/t/db_dependent/Circulation/ReturnClaims.t (+1 lines)
Lines 51-56 Koha::CirculationRules->set_rule( Link Here
51
        branchcode   => undef,
51
        branchcode   => undef,
52
        categorycode => undef,
52
        categorycode => undef,
53
        itemtype     => undef,
53
        itemtype     => undef,
54
        onsite_checkout => undef,
54
        rule_name    => 'issuelength',
55
        rule_name    => 'issuelength',
55
        rule_value   => 1
56
        rule_value   => 1
56
    }
57
    }
(-)a/t/db_dependent/Circulation/Returns.t (+1 lines)
Lines 63-68 Koha::CirculationRules->set_rule( Link Here
63
        categorycode => undef,
63
        categorycode => undef,
64
        itemtype     => undef,
64
        itemtype     => undef,
65
        branchcode   => undef,
65
        branchcode   => undef,
66
        onsite_checkout => undef,
66
        rule_name    => 'issuelength',
67
        rule_name    => 'issuelength',
67
        rule_value   => 1,
68
        rule_value   => 1,
68
    }
69
    }
(-)a/t/db_dependent/Koha/IssuingRules.t (-4 / +30 lines)
Lines 154-162 subtest 'set_rule' => sub { Link Here
154
    my $branchcode   = $builder->build({ source => 'Branch' })->{'branchcode'};
154
    my $branchcode   = $builder->build({ source => 'Branch' })->{'branchcode'};
155
    my $categorycode = $builder->build({ source => 'Category' })->{'categorycode'};
155
    my $categorycode = $builder->build({ source => 'Category' })->{'categorycode'};
156
    my $itemtype     = $builder->build({ source => 'Itemtype' })->{'itemtype'};
156
    my $itemtype     = $builder->build({ source => 'Itemtype' })->{'itemtype'};
157
    my $onsite_checkout = 0;
157
158
158
    subtest 'Correct call' => sub {
159
    subtest 'Correct call' => sub {
159
        plan tests => 4;
160
        plan tests => 5;
160
161
161
        Koha::CirculationRules->delete;
162
        Koha::CirculationRules->delete;
162
163
Lines 172-177 subtest 'set_rule' => sub { Link Here
172
            Koha::CirculationRules->set_rule( {
173
            Koha::CirculationRules->set_rule( {
173
                branchcode => $branchcode,
174
                branchcode => $branchcode,
174
                categorycode => $categorycode,
175
                categorycode => $categorycode,
176
                onsite_checkout => $onsite_checkout,
175
                rule_name => 'patron_maxissueqty',
177
                rule_name => 'patron_maxissueqty',
176
                rule_value => '',
178
                rule_value => '',
177
            } );
179
            } );
Lines 191-200 subtest 'set_rule' => sub { Link Here
191
                branchcode => $branchcode,
193
                branchcode => $branchcode,
192
                categorycode => $categorycode,
194
                categorycode => $categorycode,
193
                itemtype => $itemtype,
195
                itemtype => $itemtype,
196
                onsite_checkout => $onsite_checkout,
194
                rule_name => 'fine',
197
                rule_name => 'fine',
195
                rule_value => '',
198
                rule_value => '',
196
            } );
199
            } );
197
        }, 'setting fine with branch/category/itemtype succeeds' );
200
        }, 'setting fine with branch/category/itemtype/onsite_checkout succeeds' );
201
202
        lives_ok( sub {
203
            Koha::CirculationRules->set_rule( {
204
                branchcode => $branchcode,
205
                categorycode => $categorycode,
206
                itemtype => $itemtype,
207
                onsite_checkout => $onsite_checkout,
208
                rule_name => 'maxissueqty',
209
                rule_value => 5,
210
            } );
211
        }, 'setting maxissueqty with branch/category/itemtype/onsite_checkout succeeds' );
198
    };
212
    };
199
213
200
    subtest 'Call with missing params' => sub {
214
    subtest 'Call with missing params' => sub {
Lines 212-217 subtest 'set_rule' => sub { Link Here
212
        throws_ok( sub {
226
        throws_ok( sub {
213
            Koha::CirculationRules->set_rule( {
227
            Koha::CirculationRules->set_rule( {
214
                branchcode => $branchcode,
228
                branchcode => $branchcode,
229
                onsite_checkout => $onsite_checkout,
215
                rule_name => 'patron_maxissueqty',
230
                rule_name => 'patron_maxissueqty',
216
                rule_value => '',
231
                rule_value => '',
217
            } );
232
            } );
Lines 229-234 subtest 'set_rule' => sub { Link Here
229
            Koha::CirculationRules->set_rule( {
244
            Koha::CirculationRules->set_rule( {
230
                branchcode => $branchcode,
245
                branchcode => $branchcode,
231
                categorycode => $categorycode,
246
                categorycode => $categorycode,
247
                onsite_checkout => undef,
232
                rule_name => 'fine',
248
                rule_name => 'fine',
233
                rule_value => '',
249
                rule_value => '',
234
            } );
250
            } );
Lines 236-242 subtest 'set_rule' => sub { Link Here
236
    };
252
    };
237
253
238
    subtest 'Call with extra params' => sub {
254
    subtest 'Call with extra params' => sub {
239
        plan tests => 3;
255
        plan tests => 4;
240
256
241
        Koha::CirculationRules->delete;
257
        Koha::CirculationRules->delete;
242
258
Lines 252-257 subtest 'set_rule' => sub { Link Here
252
        throws_ok( sub {
268
        throws_ok( sub {
253
            Koha::CirculationRules->set_rule( {
269
            Koha::CirculationRules->set_rule( {
254
                branchcode => $branchcode,
270
                branchcode => $branchcode,
271
                onsite_checkout => undef,
255
                categorycode => $categorycode,
272
                categorycode => $categorycode,
256
                itemtype => $itemtype,
273
                itemtype => $itemtype,
257
                rule_name => 'patron_maxissueqty',
274
                rule_name => 'patron_maxissueqty',
Lines 268-273 subtest 'set_rule' => sub { Link Here
268
                rule_value => '',
285
                rule_value => '',
269
            } );
286
            } );
270
        }, qr/categorycode/, 'setting holdallowed with categorycode fails' );
287
        }, qr/categorycode/, 'setting holdallowed with categorycode fails' );
288
289
        throws_ok( sub {
290
            Koha::CirculationRules->set_rule( {
291
                branchcode => $branchcode,
292
                onsite_checkout => undef,
293
                rule_name => 'holdallowed',
294
                itemtype => $itemtype,
295
                rule_value => '',
296
            } );
297
        }, qr/onsite_checkout/, 'setting holdallowed with onsite_checkout fails' );
271
    };
298
    };
272
};
299
};
273
300
274
- 

Return to bug 26814