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

(-)a/C4/Reserves.pm (-3 / +28 lines)
Lines 427-434 sub CanItemBeReserved{ Link Here
427
    # we retrieve borrowers and items informations #
427
    # we retrieve borrowers and items informations #
428
    my $item     = GetItem($itemnumber);
428
    my $item     = GetItem($itemnumber);
429
    my $borrower = C4::Members::GetMember('borrowernumber'=>$borrowernumber);     
429
    my $borrower = C4::Members::GetMember('borrowernumber'=>$borrowernumber);     
430
    
430
431
    # we retrieve user rights on this itemtype and branchcode
431
432
    # Before we check too see if the borrower has exceed the
433
    # maximum number of holds allowed for this itemtype,
434
    # we need to check to see if *any* holds are allowed
435
    # for this patron/itemtype as determined by the holds policy
436
    my $holds_policy = GetBranchItemRule(
437
          $controlbranch eq "ItemHomeLibrary"
438
        ? $item->{homebranch}
439
        : $borrower->{branchcode},
440
441
        $item->{itype}
442
    );
443
444
    if ( $holds_policy->{holdallowed} == 0 ) {
445
446
        # If holdallowed is 0, we can quit right here
447
        return 0;
448
    }
449
    elsif ( $holds_policy->{holdallowed} == 1 ) {
450
451
        # If it's 1, then only patrons from the item's home library may put this book on hold.
452
        return 0 unless ( $borrower->{'branchcode'} eq $item->{'homebranch'} );
453
    }
454
455
    # If we've gotten this far, the holds policy does not prevent the patron
456
    # from placing this hold. We now need to see if the patron has exceeded
457
    # the maximum number of holds allowed for this itemtype based on the patrons
432
    my $sth = $dbh->prepare("SELECT categorycode, itemtype, branchcode, reservesallowed 
458
    my $sth = $dbh->prepare("SELECT categorycode, itemtype, branchcode, reservesallowed 
433
                             FROM issuingrules 
459
                             FROM issuingrules 
434
                             WHERE (categorycode in (?,'*') ) 
460
                             WHERE (categorycode in (?,'*') ) 
435
- 

Return to bug 10314