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

(-)a/C4/Circulation.pm (-10 / +7 lines)
Lines 52-58 use Koha::Database; Link Here
52
use Koha::Libraries;
52
use Koha::Libraries;
53
use Koha::Account::Lines;
53
use Koha::Account::Lines;
54
use Koha::Holds;
54
use Koha::Holds;
55
use Koha::RefundLostItemFeeRules;
56
use Koha::Account::Lines;
55
use Koha::Account::Lines;
57
use Koha::Account::Offsets;
56
use Koha::Account::Offsets;
58
use Koha::Config::SysPrefs;
57
use Koha::Config::SysPrefs;
Lines 1450-1460 sub AddIssue { Link Here
1450
            ## If item was lost, it has now been found, reverse any list item charges if necessary.
1449
            ## If item was lost, it has now been found, reverse any list item charges if necessary.
1451
            if ( $item_object->itemlost ) {
1450
            if ( $item_object->itemlost ) {
1452
                if (
1451
                if (
1453
                    Koha::RefundLostItemFeeRules->should_refund(
1452
                    Koha::CirculationRules->get_lostreturn_policy(
1454
                        {
1453
                        {
1455
                            current_branch      => C4::Context->userenv->{branch},
1454
                            return_branch => C4::Context->userenv->{branch},
1456
                            item_home_branch    => $item_object->homebranch,
1455
                            item          => $item_object
1457
                            item_holding_branch => $item_object->holdingbranch,
1458
                        }
1456
                        }
1459
                    )
1457
                    )
1460
                  )
1458
                  )
Lines 2034-2046 sub AddReturn { Link Here
2034
        $messages->{'WasLost'} = 1;
2032
        $messages->{'WasLost'} = 1;
2035
        unless ( C4::Context->preference("BlockReturnOfLostItems") ) {
2033
        unless ( C4::Context->preference("BlockReturnOfLostItems") ) {
2036
            if (
2034
            if (
2037
                Koha::RefundLostItemFeeRules->should_refund(
2035
                Koha::CirculationRules->get_lostreturn_policy(
2038
                    {
2036
                    {
2039
                        current_branch      => C4::Context->userenv->{branch},
2037
                        return_branch => C4::Context->userenv->{branch},
2040
                        item_home_branch    => $item->homebranch,
2038
                        item          => $item,
2041
                        item_holding_branch => $item_holding_branch
2042
                    }
2039
                    }
2043
                )
2040
                  )
2044
              )
2041
              )
2045
            {
2042
            {
2046
                _FixAccountForLostAndFound( $item->itemnumber,
2043
                _FixAccountForLostAndFound( $item->itemnumber,
(-)a/Koha/RefundLostItemFeeRules.pm (-179 lines)
Lines 1-179 Link Here
1
package Koha::RefundLostItemFeeRules;
2
3
# Copyright Theke Solutions 2016
4
#
5
# This file is part of Koha.
6
#
7
# Koha is free software; you can redistribute it and/or modify it
8
# under the terms of the GNU General Public License as published by
9
# the Free Software Foundation; either version 3 of the License, or
10
# (at your option) any later version.
11
#
12
# Koha is distributed in the hope that it will be useful, but
13
# WITHOUT ANY WARRANTY; without even the implied warranty of
14
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
# GNU General Public License for more details.
16
#
17
# You should have received a copy of the GNU General Public License
18
# along with Koha; if not, see <http://www.gnu.org/licenses>.
19
20
use Modern::Perl;
21
22
use Koha::Database;
23
use Koha::Exceptions;
24
25
use Koha::CirculationRule;
26
27
use base qw(Koha::CirculationRules);
28
29
=head1 NAME
30
31
Koha::RefundLostItemFeeRules - Koha RefundLostItemFeeRules object set class
32
33
=head1 API
34
35
=head2 Class Methods
36
37
=cut
38
39
=head3 _type
40
41
=cut
42
43
sub _type {
44
    return 'CirculationRule';
45
}
46
47
=head3 object_class
48
49
=cut
50
51
sub object_class {
52
    return 'Koha::CirculationRule';
53
}
54
55
=head3 should_refund
56
57
Koha::RefundLostItemFeeRules->should_refund()
58
59
Returns a boolean telling if the fee needs to be refund given the
60
passed params, and the current rules/sysprefs configuration.
61
62
=cut
63
64
sub should_refund {
65
66
    my $self = shift;
67
    my $params = shift;
68
69
    return $self->_effective_branch_rule( $self->_choose_branch( $params ) );
70
}
71
72
73
=head3 _effective_branch_rule
74
75
Koha::RefundLostItemFeeRules->_effective_branch_rule
76
77
Given a branch, returns a boolean representing the resulting rule.
78
It tries the branch-specific first. Then falls back to the defined default.
79
80
=cut
81
82
sub _effective_branch_rule {
83
84
    my $self   = shift;
85
    my $branch = shift;
86
87
    my $specific_rule = $self->search(
88
        {
89
            branchcode   => $branch,
90
            categorycode => undef,
91
            itemtype     => undef,
92
            rule_name    => 'refund',
93
        }
94
    )->next();
95
96
    return ( defined $specific_rule )
97
                ? $specific_rule->rule_value
98
                : $self->_default_rule;
99
}
100
101
=head3 _choose_branch
102
103
my $branch = Koha::RefundLostItemFeeRules->_choose_branch({
104
                current_branch => 'current_branch_code',
105
                item_home_branch => 'item_home_branch',
106
                item_holding_branch => 'item_holding_branch'
107
});
108
109
Helper function that determines the branch to be used to apply the rule.
110
111
=cut
112
113
sub _choose_branch {
114
115
    my $self = shift;
116
    my $param = shift;
117
118
    my $behaviour = C4::Context->preference( 'RefundLostOnReturnControl' ) // 'CheckinLibrary';
119
120
    my $param_mapping = {
121
           CheckinLibrary => 'current_branch',
122
           ItemHomeBranch => 'item_home_branch',
123
        ItemHoldingBranch => 'item_holding_branch'
124
    };
125
126
    my $branch = $param->{ $param_mapping->{ $behaviour } };
127
128
    if ( !defined $branch ) {
129
        Koha::Exceptions::MissingParameter->throw(
130
            "$behaviour requires the " .
131
            $param_mapping->{ $behaviour } .
132
            " param"
133
        );
134
    }
135
136
    return $branch;
137
}
138
139
=head3 Koha::RefundLostItemFeeRules->find();
140
141
Inherit from Koha::Objects->find(), but forces rule_name => 'refund'
142
143
=cut
144
145
sub find {
146
    my ( $self, @pars ) = @_;
147
148
    if ( ref($pars[0]) eq 'HASH' ) {
149
        $pars[0]->{rule_name} = 'refund';
150
    }
151
152
    return $self->SUPER::find(@pars);
153
}
154
155
=head3 _default_rule (internal)
156
157
This function returns the default rule defined for refunding lost
158
item fees on return. It defaults to 1 if no rule is defined.
159
160
=cut
161
162
sub _default_rule {
163
164
    my $self = shift;
165
    my $default_rule = $self->search(
166
        {
167
            branchcode   => undef,
168
            categorycode => undef,
169
            itemtype     => undef,
170
            rule_name    => 'refund',
171
        }
172
    )->next();
173
174
    return (defined $default_rule)
175
                ? $default_rule->rule_value
176
                : 1;
177
}
178
179
1;
(-)a/admin/smart-rules.pl (-3 / +3 lines)
Lines 27-33 use C4::Debug; Link Here
27
use Koha::DateUtils;
27
use Koha::DateUtils;
28
use Koha::Database;
28
use Koha::Database;
29
use Koha::Logger;
29
use Koha::Logger;
30
use Koha::RefundLostItemFeeRules;
31
use Koha::Libraries;
30
use Koha::Libraries;
32
use Koha::CirculationRules;
31
use Koha::CirculationRules;
33
use Koha::Patron::Categories;
32
use Koha::Patron::Categories;
Lines 549-558 elsif ( $op eq 'mod-refund-lost-item-fee-rule' ) { Link Here
549
    }
548
    }
550
}
549
}
551
550
552
my $refundLostItemFeeRule = Koha::RefundLostItemFeeRules->find({ branchcode => ($branch eq '*') ? undef : $branch });
551
my $refundLostItemFeeRule = Koha::CirculationRules->find({ branchcode => ($branch eq '*') ? undef : $branch, rule_name => 'refund' });
552
my $defaultLostItemFeeRule = Koha::CirculationRules->find({ branchcode => undef, rule_name => 'refund' });
553
$template->param(
553
$template->param(
554
    refundLostItemFeeRule => $refundLostItemFeeRule,
554
    refundLostItemFeeRule => $refundLostItemFeeRule,
555
    defaultRefundRule     => Koha::RefundLostItemFeeRules->_default_rule
555
    defaultRefundRule     => $defaultLostItemFeeRule ? $defaultLostItemFeeRule->rule_value : 1
556
);
556
);
557
557
558
my $patron_categories = Koha::Patron::Categories->search({}, { order_by => ['description'] });
558
my $patron_categories = Koha::Patron::Categories->search({}, { order_by => ['description'] });
(-)a/t/db_dependent/RefundLostItemFeeRule.t (-459 lines)
Lines 1-459 Link Here
1
#!/usr/bin/perl
2
3
# This file is part of Koha.
4
#
5
# Koha is free software; you can redistribute it and/or modify it
6
# under the terms of the GNU General Public License as published by
7
# the Free Software Foundation; either version 3 of the License, or
8
# (at your option) any later version.
9
#
10
# Koha is distributed in the hope that it will be useful, but
11
# WITHOUT ANY WARRANTY; without even the implied warranty of
12
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
# GNU General Public License for more details.
14
#
15
# You should have received a copy of the GNU General Public License
16
# along with Koha; if not, see <http://www.gnu.org/licenses>.
17
18
use Modern::Perl;
19
20
use Test::More tests => 9;
21
use t::lib::Mocks;
22
use t::lib::TestBuilder;
23
24
use C4::Context;
25
use Koha::Database;
26
27
BEGIN {
28
    use_ok('Koha::Object');
29
    use_ok('Koha::CirculationRule');
30
    use_ok('Koha::RefundLostItemFeeRules');
31
}
32
33
my $schema = Koha::Database->new->schema;
34
my $builder = t::lib::TestBuilder->new;
35
36
subtest 'Koha::RefundLostItemFeeRule::delete() tests' => sub {
37
38
    plan tests => 5;
39
40
    # Start transaction
41
    $schema->storage->txn_begin;
42
43
    # Clean the table
44
    $schema->resultset('CirculationRule')->search()->delete;
45
46
    my $generated_default_rule = $builder->build(
47
        {
48
            source => 'CirculationRule',
49
            value  => {
50
                branchcode   => undef,
51
                categorycode => undef,
52
                itemtype     => undef,
53
                rule_name    => 'refund',
54
            }
55
        }
56
    );
57
    my $branchcode = $builder->build( { source => 'Branch' } )->{branchcode};
58
    my $generated_other_rule = $builder->build(
59
        {
60
            source => 'CirculationRule',
61
            value  => {
62
                branchcode   => $branchcode,
63
                categorycode => undef,
64
                itemtype     => undef,
65
                rule_name    => 'refund',
66
            }
67
        }
68
    );
69
70
    my $default_rule = Koha::CirculationRules->search(
71
        {
72
            branchcode   => undef,
73
            categorycode => undef,
74
            itemtype     => undef,
75
            rule_name    => 'refund',
76
        }
77
    )->next();
78
    ok( defined $default_rule, 'Default rule created' );
79
    ok( $default_rule->_result->in_storage, 'Default rule actually in storage');
80
81
    my $other_rule = Koha::CirculationRules->search(
82
        {
83
            branchcode   => $generated_other_rule->{branchcode},
84
            categorycode => undef,
85
            itemtype     => undef,
86
            rule_name    => 'refund',
87
        }
88
    )->next();
89
    ok( defined $other_rule, 'Other rule created' );
90
    ok( $other_rule->_result->in_storage, 'Other rule actually in storage');
91
92
    # deleting the regular rule
93
    $other_rule->delete;
94
    ok( !$other_rule->_result->in_storage, 'Other rule deleted from storage' );
95
96
    # Rollback transaction
97
    $schema->storage->txn_rollback;
98
};
99
100
subtest 'Koha::RefundLostItemFeeRules::_default_rule() tests' => sub {
101
102
    plan tests => 6;
103
104
    # Start transaction
105
    $schema->storage->txn_begin;
106
107
    # Clean the table
108
    $schema->resultset('CirculationRule')->search()->delete;
109
110
    my $generated_default_rule = $builder->build(
111
        {
112
            source => 'CirculationRule',
113
            value  => {
114
                branchcode   => undef,
115
                categorycode => undef,
116
                itemtype     => undef,
117
                rule_name    => 'refund',
118
                rule_value   => 1,
119
            }
120
        }
121
    );
122
    my $branchcode = $builder->build( { source => 'Branch' } )->{branchcode};
123
    my $generated_other_rule = $builder->build(
124
        {
125
            source => 'CirculationRule',
126
            value  => {
127
                branchcode   => $branchcode,
128
                categorycode => undef,
129
                itemtype     => undef,
130
                rule_name    => 'refund',
131
            }
132
        }
133
    );
134
135
    my $default_rule = Koha::CirculationRules->search(
136
        {
137
            branchcode   => undef,
138
            categorycode => undef,
139
            itemtype     => undef,
140
            rule_name    => 'refund',
141
        }
142
    )->next();
143
    ok( defined $default_rule, 'Default rule created' );
144
    ok( $default_rule->_result->in_storage, 'Default rule actually in storage');
145
    is( Koha::RefundLostItemFeeRules->_default_rule, 1, 'Default rule is set to refund' );
146
147
    # Change default rule to "Don't refund"
148
    $default_rule->rule_value(0);
149
    $default_rule->store;
150
    # Re-read from DB, to be sure
151
    $default_rule = Koha::CirculationRules->search(
152
        {
153
            branchcode   => undef,
154
            categorycode => undef,
155
            itemtype     => undef,
156
            rule_name    => 'refund',
157
        }
158
    )->next();
159
    ok( !Koha::RefundLostItemFeeRules->_default_rule, 'Default rule is set to not refund' );
160
161
    $default_rule->delete;
162
    ok( !$default_rule->_result->in_storage, 'Default rule effectively deleted from storage' );
163
164
    ok( Koha::RefundLostItemFeeRules->_default_rule, 'Default rule is set to refund if no default rule is present' );
165
166
    # Rollback transaction
167
    $schema->storage->txn_rollback;
168
};
169
170
subtest 'Koha::RefundLostItemFeeRules::_effective_branch_rule() tests' => sub {
171
172
    plan tests => 3;
173
174
    # Start transaction
175
    $schema->storage->txn_begin;
176
177
    # Clean the table
178
    $schema->resultset('CirculationRule')->search()->delete;
179
180
    my $default_rule = $builder->build(
181
        {
182
            source => 'CirculationRule',
183
            value  => {
184
                branchcode   => undef,
185
                categorycode => undef,
186
                itemtype     => undef,
187
                rule_name    => 'refund',
188
                rule_value   => 1,
189
            }
190
        }
191
    );
192
    my $branchcode = $builder->build( { source => 'Branch' } )->{branchcode};
193
    my $specific_rule_false = $builder->build(
194
        {
195
            source => 'CirculationRule',
196
            value  => {
197
                branchcode   => $branchcode,
198
                categorycode => undef,
199
                itemtype     => undef,
200
                rule_name    => 'refund',
201
                rule_value   => 0,
202
            }
203
        }
204
    );
205
    my $branchcode2 = $builder->build( { source => 'Branch' } )->{branchcode};
206
    my $specific_rule_true = $builder->build(
207
        {
208
            source => 'CirculationRule',
209
            value  => {
210
                branchcode   => $branchcode2,
211
                categorycode => undef,
212
                itemtype     => undef,
213
                rule_name    => 'refund',
214
                rule_value   => 1,
215
            }
216
        }
217
    );
218
219
    is( Koha::RefundLostItemFeeRules->_effective_branch_rule( $specific_rule_true->{ branchcode } ),
220
          1,'Specific rule is applied (true)');
221
    is( Koha::RefundLostItemFeeRules->_effective_branch_rule( $specific_rule_false->{ branchcode } ),
222
          0,'Specific rule is applied (false)');
223
    # Delete specific rules
224
    Koha::RefundLostItemFeeRules->find({ branchcode => $specific_rule_false->{ branchcode } })->delete;
225
    is( Koha::RefundLostItemFeeRules->_effective_branch_rule( $specific_rule_false->{ branchcode } ),
226
          1,'No specific rule defined, fallback to global (true)');
227
228
    # Rollback transaction
229
    $schema->storage->txn_rollback;
230
};
231
232
subtest 'Koha::RefundLostItemFeeRules::_choose_branch() tests' => sub {
233
234
    plan tests => 9;
235
236
    # Start transaction
237
    $schema->storage->txn_begin;
238
239
    my $params = {
240
        current_branch => 'current_branch_code',
241
        item_holding_branch => 'item_holding_branch_code',
242
        item_home_branch => 'item_home_branch_code'
243
    };
244
245
    t::lib::Mocks::mock_preference( 'RefundLostOnReturnControl', 'CheckinLibrary' );
246
247
    is( Koha::RefundLostItemFeeRules->_choose_branch( $params ),
248
        'current_branch_code', 'CheckinLibrary is honoured');
249
250
    t::lib::Mocks::mock_preference( 'RefundLostOnReturnControl', 'ItemHomeBranch' );
251
    is( Koha::RefundLostItemFeeRules->_choose_branch( $params ),
252
        'item_home_branch_code', 'ItemHomeBranch is honoured');
253
254
    t::lib::Mocks::mock_preference( 'RefundLostOnReturnControl', 'ItemHoldingBranch' );
255
    is( Koha::RefundLostItemFeeRules->_choose_branch( $params ),
256
        'item_holding_branch_code', 'ItemHoldingBranch is honoured');
257
258
    t::lib::Mocks::mock_preference( 'RefundLostOnReturnControl', 'CheckinLibrary' );
259
    eval {
260
        Koha::RefundLostItemFeeRules->_choose_branch();
261
    };
262
    is( ref($@), 'Koha::Exceptions::MissingParameter',
263
        'Missing parameter exception' );
264
    is( $@->message, 'CheckinLibrary requires the current_branch param',
265
        'Exception message is correct' );
266
267
    t::lib::Mocks::mock_preference( 'RefundLostOnReturnControl', 'ItemHomeBranch' );
268
    eval {
269
        Koha::RefundLostItemFeeRules->_choose_branch();
270
    };
271
    is( ref($@), 'Koha::Exceptions::MissingParameter',
272
        'Missing parameter exception' );
273
    is( $@->message, 'ItemHomeBranch requires the item_home_branch param',
274
        'Exception message is correct' );
275
276
    t::lib::Mocks::mock_preference( 'RefundLostOnReturnControl', 'ItemHoldingBranch' );
277
    eval {
278
        Koha::RefundLostItemFeeRules->_choose_branch();
279
    };
280
    is( ref($@), 'Koha::Exceptions::MissingParameter',
281
        'Missing parameter exception' );
282
    is( $@->message, 'ItemHoldingBranch requires the item_holding_branch param',
283
        'Exception message is correct' );
284
285
    # Rollback transaction
286
    $schema->storage->txn_rollback;
287
};
288
289
subtest 'Koha::RefundLostItemFeeRules::should_refund() tests' => sub {
290
291
    plan tests => 3;
292
293
    # Start transaction
294
    $schema->storage->txn_begin;
295
296
    t::lib::Mocks::mock_preference( 'RefundLostOnReturnControl', 'CheckinLibrary' );
297
298
    $schema->resultset('CirculationRule')->search()->delete;
299
300
    my $default_rule = $builder->build(
301
        {
302
            source => 'CirculationRule',
303
            value  => {
304
                branchcode   => undef,
305
                categorycode => undef,
306
                itemtype     => undef,
307
                rule_name    => 'refund',
308
                rule_value   => 1
309
            }
310
        }
311
    );
312
    my $branchcode = $builder->build( { source => 'Branch' } )->{branchcode};
313
    my $specific_rule_false = $builder->build(
314
        {
315
            source => 'CirculationRule',
316
            value  => {
317
                branchcode   => $branchcode,
318
                categorycode => undef,
319
                itemtype     => undef,
320
                rule_name    => 'refund',
321
                rule_value   => 0
322
            }
323
        }
324
    );
325
    my $branchcode2 = $builder->build( { source => 'Branch' } )->{branchcode};
326
    my $specific_rule_true = $builder->build(
327
        {
328
            source => 'CirculationRule',
329
            value  => {
330
                branchcode   => $branchcode2,
331
                categorycode => undef,
332
                itemtype     => undef,
333
                rule_name    => 'refund',
334
                rule_value   => 1
335
            }
336
        }
337
    );
338
    # Make sure we have an unused branchcode
339
    my $branchcode3 = $builder->build( { source => 'Branch' } )->{branchcode};
340
    my $specific_rule_dummy = $builder->build(
341
        {
342
            source => 'CirculationRule',
343
            value  => {
344
                branchcode   => $branchcode3,
345
                categorycode => undef,
346
                itemtype     => undef,
347
                rule_name    => 'refund',
348
            }
349
        }
350
    );
351
    my $branch_without_rule = $specific_rule_dummy->{ branchcode };
352
    Koha::CirculationRules
353
        ->search(
354
            {
355
                branchcode   => $branch_without_rule,
356
                categorycode => undef,
357
                itemtype     => undef,
358
                rule_name    => 'refund'
359
            }
360
          )
361
        ->next
362
        ->delete;
363
364
    my $params = {
365
        current_branch => $specific_rule_true->{ branchcode },
366
        # patron_branch  => $specific_rule_false->{ branchcode },
367
        item_holding_branch => $branch_without_rule,
368
        item_home_branch => $branch_without_rule
369
    };
370
371
    t::lib::Mocks::mock_preference( 'RefundLostOnReturnControl', 'CheckinLibrary' );
372
    is( Koha::RefundLostItemFeeRules->should_refund( $params ),
373
          1,'Specific rule is applied (true)');
374
375
    t::lib::Mocks::mock_preference( 'RefundLostOnReturnControl', 'ItemHomeBranch' );
376
    is( Koha::RefundLostItemFeeRules->should_refund( $params ),
377
         1,'No rule for branch, global rule applied (true)');
378
379
    # Change the default value just to try
380
    Koha::CirculationRules->search({ branchcode => undef, rule_name => 'refund' })->next->rule_value(0)->store;
381
    t::lib::Mocks::mock_preference( 'RefundLostOnReturnControl', 'ItemHoldingBranch' );
382
    is( Koha::RefundLostItemFeeRules->should_refund( $params ),
383
         0,'No rule for branch, global rule applied (false)');
384
385
    # Rollback transaction
386
    $schema->storage->txn_rollback;
387
};
388
389
subtest 'Koha::RefundLostItemFeeRules::find() tests' => sub {
390
391
    plan tests => 5;
392
393
    # Start transaction
394
    $schema->storage->txn_begin;
395
396
    t::lib::Mocks::mock_preference( 'RefundLostOnReturnControl', 'CheckinLibrary' );
397
398
    $schema->resultset('CirculationRule')->search()->delete;
399
400
    my $default_non_refund = $builder->build(
401
        {
402
            source => 'CirculationRule',
403
            value  => {
404
                branchcode   => undef,
405
                categorycode => undef,
406
                itemtype     => undef,
407
                rule_name    => 'non_refund_rule',
408
                rule_value   => 1
409
            }
410
        }
411
    );
412
413
    ok(defined Koha::RefundLostItemFeeRules->find($default_non_refund->{id}), 'Find should continue to work when passed an id');
414
415
    my $specific_non_refund = $builder->build(
416
        {
417
            source => 'CirculationRule',
418
            value  => {
419
                categorycode => undef,
420
                itemtype     => undef,
421
                rule_name    => 'non_refund_rule',
422
                rule_value   => 0
423
            }
424
        }
425
    );
426
427
    ok(!defined Koha::RefundLostItemFeeRules->find({ branchcode => undef }), 'Non refund default rules are not found');
428
    ok(!defined Koha::RefundLostItemFeeRules->find({ branchcode => $specific_non_refund->{branchcode} }), 'Non refund specific rules are not found');
429
430
    my $default_refund = $builder->build(
431
        {
432
            source => 'CirculationRule',
433
            value  => {
434
                branchcode   => undef,
435
                categorycode => undef,
436
                itemtype     => undef,
437
                rule_name    => 'refund',
438
                rule_value   => 1
439
            }
440
        }
441
    );
442
    my $specific_refund = $builder->build(
443
        {
444
            source => 'CirculationRule',
445
            value  => {
446
                categorycode => undef,
447
                itemtype     => undef,
448
                rule_name    => 'refund',
449
                rule_value   => 0
450
            }
451
        }
452
    );
453
454
    ok(defined Koha::RefundLostItemFeeRules->find({ branchcode => undef }), 'Refund default rules are found');
455
    ok(defined Koha::RefundLostItemFeeRules->find({ branchcode => $specific_refund->{branchcode} }), 'Refund specific rules are found');
456
457
    # Rollback transaction
458
    $schema->storage->txn_rollback;
459
};
(-)a/t/lib/TestBuilder.pm (-5 / +1 lines)
Lines 577-586 sub _gen_default_values { Link Here
577
        },
577
        },
578
        AuthHeader => {
578
        AuthHeader => {
579
            marcxml => '',
579
            marcxml => '',
580
        },
580
        }
581
        RefundLostItemFeeRules => {
582
            rule_name => 'refund',
583
        },
584
    };
581
    };
585
}
582
}
586
583
587
- 

Return to bug 25663