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

(-)a/C4/Reserves.pm (-3 / +3 lines)
Lines 275-280 sub CanBookBeReserved{ Link Here
275
    foreach my $item (@$items) {
275
    foreach my $item (@$items) {
276
        $canReserve = CanItemBeReserved( $borrowernumber, $item );
276
        $canReserve = CanItemBeReserved( $borrowernumber, $item );
277
        return 'OK' if $canReserve eq 'OK';
277
        return 'OK' if $canReserve eq 'OK';
278
        return $canReserve if $canReserve eq 'debarred'; # no need to continue
278
    }
279
    }
279
    return $canReserve;
280
    return $canReserve;
280
}
281
}
Lines 307-317 sub CanItemBeReserved { Link Here
307
    my $item       = GetItem($itemnumber);
308
    my $item       = GetItem($itemnumber);
308
    my $biblio     = Koha::Biblios->find( $item->{biblionumber} );
309
    my $biblio     = Koha::Biblios->find( $item->{biblionumber} );
309
    my $patron = Koha::Patrons->find( $borrowernumber );
310
    my $patron = Koha::Patrons->find( $borrowernumber );
310
    my $borrower = $patron->unblessed;
311
    if( !$patron || $patron->is_debarred ) {
311
312
    if ($patron->is_debarred) {
313
        return 'debarred';
312
        return 'debarred';
314
    }
313
    }
314
    my $borrower = $patron->unblessed;
315
315
316
    # If an item is damaged and we don't allow holds on damaged items, we can stop right here
316
    # If an item is damaged and we don't allow holds on damaged items, we can stop right here
317
    return 'damaged'
317
    return 'damaged'
(-)a/t/db_dependent/Holds.t (-4 / +4 lines)
Lines 7-13 use t::lib::TestBuilder; Link Here
7
7
8
use C4::Context;
8
use C4::Context;
9
9
10
use Test::More tests => 56;
10
use Test::More tests => 57;
11
use MARC::Record;
11
use MARC::Record;
12
use C4::Biblio;
12
use C4::Biblio;
13
use C4::Items;
13
use C4::Items;
Lines 418-425 my $debarred_borrowernumber = AddMember( Link Here
418
    branchcode => $branch_1,
418
    branchcode => $branch_1,
419
    debarred => '9999-12-31',
419
    debarred => '9999-12-31',
420
);
420
);
421
is(CanItemBeReserved($debarred_borrowernumber, $itemnumber),
421
is( CanBookBeReserved($debarred_borrowernumber, $bibnum), 'debarred', 'CanBookBeReserved returns debarred on debarred patron' );
422
    'debarred', 'Debarred patron cannot reserve');
422
is( CanItemBeReserved($debarred_borrowernumber, $itemnumber),
423
    'debarred', 'CanItemBeReserved returns debarred for debarred patron' );
423
424
424
425
425
# Helper method to set up a Biblio.
426
# Helper method to set up a Biblio.
426
- 

Return to bug 17247