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

(-)a/C4/Reserves.pm (-10 / +5 lines)
Lines 485-494 sub CanItemBeReserved { Link Here
485
        }
485
        }
486
    }
486
    }
487
487
488
    # we retrieve borrowers and items informations #
489
    # item->{itype} will come for biblioitems if necessery
490
    my $borrower = $patron->unblessed;
491
492
    # If an item is damaged and we don't allow holds on damaged items, we can stop right here
488
    # If an item is damaged and we don't allow holds on damaged items, we can stop right here
493
    return _cache { status =>'damaged' }
489
    return _cache { status =>'damaged' }
494
      if ( $item->damaged
490
      if ( $item->damaged
Lines 526-539 sub CanItemBeReserved { Link Here
526
    }
522
    }
527
    elsif ( $controlbranch eq "PatronLibrary" ) {
523
    elsif ( $controlbranch eq "PatronLibrary" ) {
528
        $branchfield = "borrowers.branchcode";
524
        $branchfield = "borrowers.branchcode";
529
        $reserves_control_branch  = $borrower->{branchcode};
525
        $reserves_control_branch  = $patron->branchcode;
530
    }
526
    }
531
527
532
    # we retrieve rights
528
    # we retrieve rights
533
    if (
529
    if (
534
        my $reservesallowed = Koha::CirculationRules->get_effective_rule({
530
        my $reservesallowed = Koha::CirculationRules->get_effective_rule({
535
                itemtype     => $item->effective_itemtype,
531
                itemtype     => $item->effective_itemtype,
536
                categorycode => $borrower->{categorycode},
532
                categorycode => $patron->categorycode,
537
                branchcode   => $reserves_control_branch,
533
                branchcode   => $reserves_control_branch,
538
                rule_name    => 'reservesallowed',
534
                rule_name    => 'reservesallowed',
539
        })
535
        })
Lines 546-552 sub CanItemBeReserved { Link Here
546
    }
542
    }
547
543
548
    my $rights = Koha::CirculationRules->get_effective_rules({
544
    my $rights = Koha::CirculationRules->get_effective_rules({
549
        categorycode => $borrower->{'categorycode'},
545
        categorycode => $patron->categorycode,
550
        itemtype     => $item->effective_itemtype,
546
        itemtype     => $item->effective_itemtype,
551
        branchcode   => $reserves_control_branch,
547
        branchcode   => $reserves_control_branch,
552
        rules        => ['holds_per_record','holds_per_day']
548
        rules        => ['holds_per_record','holds_per_day']
Lines 655-661 sub CanItemBeReserved { Link Here
655
    }
651
    }
656
652
657
    if (   $branchitemrule->{holdallowed} eq 'from_home_library'
653
    if (   $branchitemrule->{holdallowed} eq 'from_home_library'
658
        && $borrower->{branchcode} ne $item->homebranch )
654
        && $patron->branchcode ne $item->homebranch )
659
    {
655
    {
660
        return _cache { status => 'cannotReserveFromOtherBranches' };
656
        return _cache { status => 'cannotReserveFromOtherBranches' };
661
    }
657
    }
Lines 684-690 sub CanItemBeReserved { Link Here
684
        if ($branchitemrule->{hold_fulfillment_policy} eq 'holdgroup' && !$item_library->validate_hold_sibling( {branchcode => $pickup_branchcode} )) {
680
        if ($branchitemrule->{hold_fulfillment_policy} eq 'holdgroup' && !$item_library->validate_hold_sibling( {branchcode => $pickup_branchcode} )) {
685
            return _cache { status => 'pickupNotInHoldGroup' };
681
            return _cache { status => 'pickupNotInHoldGroup' };
686
        }
682
        }
687
        if ($branchitemrule->{hold_fulfillment_policy} eq 'patrongroup' && !Koha::Libraries->find({branchcode => $borrower->{branchcode}})->validate_hold_sibling({branchcode => $pickup_branchcode})) {
683
        if ($branchitemrule->{hold_fulfillment_policy} eq 'patrongroup' && !Koha::Libraries->find({branchcode => $patron->branchcode})->validate_hold_sibling({branchcode => $pickup_branchcode})) {
688
            return _cache { status => 'pickupNotInHoldGroup' };
684
            return _cache { status => 'pickupNotInHoldGroup' };
689
        }
685
        }
690
    }
686
    }
691
- 

Return to bug 37155