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

(-)a/C4/Reserves.pm (+6 lines)
Lines 44-49 use Koha::Holds; Link Here
44
use Koha::Libraries;
44
use Koha::Libraries;
45
use Koha::Items;
45
use Koha::Items;
46
use Koha::ItemTypes;
46
use Koha::ItemTypes;
47
use Koha::Patrons;
47
48
48
use List::MoreUtils qw( firstidx any );
49
use List::MoreUtils qw( firstidx any );
49
use Carp;
50
use Carp;
Lines 456-461 sub CanBookBeReserved{ Link Here
456
         cannotReserveFromOtherBranches, if syspref 'canreservefromotherbranches' is OK.
457
         cannotReserveFromOtherBranches, if syspref 'canreservefromotherbranches' is OK.
457
         tooManyReserves, if the borrower has exceeded his maximum reserve amount.
458
         tooManyReserves, if the borrower has exceeded his maximum reserve amount.
458
         notReservable,   if holds on this item are not allowed
459
         notReservable,   if holds on this item are not allowed
460
         debarred,        if patron is debarred
459
461
460
=cut
462
=cut
461
463
Lines 472-477 sub CanItemBeReserved{ Link Here
472
    my $biblioData = C4::Biblio::GetBiblioData( $item->{biblionumber} );
474
    my $biblioData = C4::Biblio::GetBiblioData( $item->{biblionumber} );
473
    my $borrower = C4::Members::GetMember('borrowernumber'=>$borrowernumber);
475
    my $borrower = C4::Members::GetMember('borrowernumber'=>$borrowernumber);
474
476
477
    if (Koha::Patrons->find($borrowernumber)->is_debarred) {
478
        return 'debarred';
479
    }
480
475
    # If an item is damaged and we don't allow holds on damaged items, we can stop right here
481
    # If an item is damaged and we don't allow holds on damaged items, we can stop right here
476
    return 'damaged' if ( $item->{damaged} && !C4::Context->preference('AllowHoldsOnDamagedItems') );
482
    return 'damaged' if ( $item->{damaged} && !C4::Context->preference('AllowHoldsOnDamagedItems') );
477
483
(-)a/t/db_dependent/Holds.t (-2 / +11 lines)
Lines 8-14 use t::lib::TestBuilder; Link Here
8
use C4::Context;
8
use C4::Context;
9
use C4::Branch;
9
use C4::Branch;
10
10
11
use Test::More tests => 60;
11
use Test::More tests => 61;
12
use MARC::Record;
12
use MARC::Record;
13
use C4::Biblio;
13
use C4::Biblio;
14
use C4::Items;
14
use C4::Items;
Lines 473-478 my $res_id = AddReserve( $branch_1, $borrowernumbers[0], $bibnum, '', 1, ); Link Here
473
is( CanItemBeReserved( $borrowernumbers[0], $itemnumber ),
473
is( CanItemBeReserved( $borrowernumbers[0], $itemnumber ),
474
    'tooManyReserves', 'Patron cannot reserve item with hold limit of 1, 1 bib level hold placed' );
474
    'tooManyReserves', 'Patron cannot reserve item with hold limit of 1, 1 bib level hold placed' );
475
475
476
my $debarred_borrowernumber = AddMember(
477
    firstname => 'Debarred',
478
    surname => 'Patron',
479
    categorycode => $category->{categorycode},
480
    branchcode => $branch_1,
481
    debarred => '9999-12-31',
482
);
483
is(CanItemBeReserved($debarred_borrowernumber, $itemnumber),
484
    'debarred', 'Debarred patron cannot reserve');
485
476
486
477
# Helper method to set up a Biblio.
487
# Helper method to set up a Biblio.
478
sub create_helper_biblio {
488
sub create_helper_biblio {
479
- 

Return to bug 17247