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

(-)a/t/db_dependent/Holds.t (-19 / +1 lines)
Lines 43-54 my $dbh = C4::Context->dbh; Link Here
43
my $branch_1 = $builder->build({ source => 'Branch' })->{ branchcode };
43
my $branch_1 = $builder->build({ source => 'Branch' })->{ branchcode };
44
my $branch_2 = $builder->build({ source => 'Branch' })->{ branchcode };
44
my $branch_2 = $builder->build({ source => 'Branch' })->{ branchcode };
45
45
46
my $category = $builder->build({
46
my $category = $builder->build({ source => 'Category' });
47
    source => 'Category',
48
    value => {
49
        BlockExpiredPatronOpacActions => -1,
50
    },
51
});
52
47
53
my $borrowers_count = 5;
48
my $borrowers_count = 5;
54
49
Lines 132-150 my $patron = Koha::Patrons->find( $borrowernumbers[0] ); Link Here
132
$holds = $patron->holds;
127
$holds = $patron->holds;
133
is( $holds->next->borrowernumber, $borrowernumbers[0], "Test Koha::Patron->holds");
128
is( $holds->next->borrowernumber, $borrowernumbers[0], "Test Koha::Patron->holds");
134
129
135
my $expired_borrowernumber = Koha::Patron->new({
136
        firstname =>  'Expired',
137
        surname => 'Patron',
138
        categorycode => $category->{categorycode},
139
        branchcode => $branch_1,
140
	dateexpiry => '2000-01-01',
141
    })->store->borrowernumber;
142
143
t::lib::Mocks::mock_preference('BlockExpiredPatronOpacActions', 1);
144
ok(
145
    CanItemBeReserved($expired_borrowernumber, $itemnumber)->{status} eq 'patronExpired',
146
    'Expired patron cannot reserve'
147
);
148
130
149
$holds = $item->current_holds;
131
$holds = $item->current_holds;
150
$first_hold = $holds->next;
132
$first_hold = $holds->next;
(-)a/t/db_dependent/ILSDI_Services.t (-2 / +35 lines)
Lines 300-306 subtest 'LookupPatron test' => sub { Link Here
300
300
301
subtest 'Holds test' => sub {
301
subtest 'Holds test' => sub {
302
302
303
    plan tests => 7;
303
    plan tests => 8;
304
304
305
    $schema->storage->txn_begin;
305
    $schema->storage->txn_begin;
306
306
Lines 427-432 subtest 'Holds test' => sub { Link Here
427
    is( $reply->{code}, 'alreadypossession', "Patron has issued same book" );
427
    is( $reply->{code}, 'alreadypossession', "Patron has issued same book" );
428
    is( $reply->{pickup_location}, undef, "No reserve placed");
428
    is( $reply->{pickup_location}, undef, "No reserve placed");
429
429
430
    # Test Patron cannot reserve if expired and BlockExpiredPatronOpacActions
431
    my $category = $builder->build({
432
        source => 'Category',
433
        value => { BlockExpiredPatronOpacActions => -1 }
434
        });
435
436
    my $branch_1 = $builder->build({ source => 'Branch' })->{ branchcode };
437
438
    my $expired_borrowernumber = Koha::Patron->new({
439
        firstname =>  'Expired',
440
        surname => 'Patron',
441
        categorycode => $category->{categorycode},
442
        branchcode => $branch_1,
443
        dateexpiry => '2000-01-01',
444
    })->store->borrowernumber;
445
446
    t::lib::Mocks::mock_preference('BlockExpiredPatronOpacActions', 1);
447
448
    my $item5 = $builder->build({
449
        source => 'Item',
450
        value => {
451
            biblionumber => $biblio_with_no_item->{biblionumber},
452
            damaged => 0,
453
        }
454
    });
455
456
    $query = new CGI;
457
    $query->param( 'patron_id', $expired_borrowernumber);
458
    $query->param( 'bib_id', $biblio_with_no_item->{biblionumber});
459
    $query->param( 'item_id', $item5->{itemnumber});
460
461
    $reply = C4::ILSDI::Services::HoldItem( $query );
462
    is( $reply->{code}, 'PatronExpired', "Patron is expired" );
463
430
    $schema->storage->txn_rollback;
464
    $schema->storage->txn_rollback;
431
};
465
};
432
466
433
- 

Return to bug 17229