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

(-)a/t/db_dependent/Circulation/MarkIssueReturned.t (-28 / +35 lines)
Lines 190-210 subtest 'AutoRemoveOverduesRestrictions' => sub { Link Here
190
    my $categorycode = $patron->categorycode;
190
    my $categorycode = $patron->categorycode;
191
    my $branchcode   = $patron->branchcode;
191
    my $branchcode   = $patron->branchcode;
192
192
193
    $dbh->do(
193
    Koha::CirculationRules->search->delete;
194
        qq{
194
    Koha::CirculationRules->set_rules(
195
        INSERT INTO `overduerules` (
195
        {
196
            `categorycode`,
196
            categorycode => $categorycode,
197
            `delay1`,
197
            itemtype     => undef,
198
            `letter1`,
198
            branchcode   => undef,
199
            `debarred1`,
199
            rules        => {
200
            `delay2`,
200
                overdue_1_delay    => 6,
201
            `letter2`,
201
                overdue_1_notice   => 'ODUE',
202
            `debarred2`
202
                overdue_1_mtt      => 'email',
203
        )
203
                overdue_1_restrict => 0,
204
        VALUES ('$categorycode', 6, 'ODUE', 0, 10, 'ODUE2', 1)
204
                overdue_2_delay    => 10,
205
    }
205
                overdue_2_notice   => 'ODUE2',
206
                overdue_2_mtt      => 'email',
207
                overdue_2_restrict => 1
208
            }
209
        }
206
    );
210
    );
207
211
212
    note("Testing when_no_overdue");
208
    t::lib::Mocks::mock_preference( 'AutoRemoveOverduesRestrictions', 'when_no_overdue' );
213
    t::lib::Mocks::mock_preference( 'AutoRemoveOverduesRestrictions', 'when_no_overdue' );
209
214
210
    t::lib::Mocks::mock_userenv( { branchcode => $branchcode } );
215
    t::lib::Mocks::mock_userenv( { branchcode => $branchcode } );
Lines 235-240 subtest 'AutoRemoveOverduesRestrictions' => sub { Link Here
235
    $restrictions = $patron->restrictions;
240
    $restrictions = $patron->restrictions;
236
    is( $restrictions->count, 0, 'OVERDUES debarment is removed if patron does not have overdues' );
241
    is( $restrictions->count, 0, 'OVERDUES debarment is removed if patron does not have overdues' );
237
242
243
    note("Testing when_no_overdue_causing_debarment");
238
    t::lib::Mocks::mock_preference( 'AutoRemoveOverduesRestrictions', 'when_no_overdue_causing_debarment' );
244
    t::lib::Mocks::mock_preference( 'AutoRemoveOverduesRestrictions', 'when_no_overdue_causing_debarment' );
239
245
240
    my $ten_days_ago = dt_from_string->subtract( days => 10 );
246
    my $ten_days_ago = dt_from_string->subtract( days => 10 );
Lines 282-301 subtest 'AutoRemoveOverduesRestrictions' => sub { Link Here
282
    $checkout_2 = AddIssue( $patron, $item_2->barcode, $eleven_days_ago );
288
    $checkout_2 = AddIssue( $patron, $item_2->barcode, $eleven_days_ago );
283
289
284
    # $checkout_1 should now not trigger debarment with this new rule for specific branchcode
290
    # $checkout_1 should now not trigger debarment with this new rule for specific branchcode
285
    $dbh->do(
291
    Koha::CirculationRules->set_rules(
286
        qq{
292
        {
287
        INSERT INTO `overduerules` (
293
            categorycode => $categorycode,
288
            `branchcode`,
294
            itemtype     => undef,
289
            `categorycode`,
295
            branchcode   => $branchcode,
290
            `delay1`,
296
            rules        => {
291
            `letter1`,
297
                overdue_1_delay    => 6,
292
            `debarred1`,
298
                overdue_1_notice   => 'ODUE',
293
            `delay2`,
299
                overdue_1_mtt      => 'email',
294
            `letter2`,
300
                overdue_1_restrict => 0,
295
            `debarred2`
301
                overdue_2_delay    => 11,
296
        )
302
                overdue_2_notice   => 'ODUE2',
297
        VALUES ('$branchcode', '$categorycode', 6, 'ODUE', 0, 11, 'ODUE2', 1)
303
                overdue_2_mtt      => 'email',
298
    }
304
                overdue_2_restrict => 1
305
            }
306
        }
299
    );
307
    );
300
308
301
    C4::Circulation::MarkIssueReturned( $patron->borrowernumber, $item_2->itemnumber );
309
    C4::Circulation::MarkIssueReturned( $patron->borrowernumber, $item_2->itemnumber );
302
- 

Return to bug 10190