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

(-)a/C4/Reserves.pm (-2 / +3 lines)
Lines 330-336 sub CanBookBeReserved{ Link Here
330
    my $canReserve = { status => '' };
330
    my $canReserve = { status => '' };
331
    foreach my $itemnumber (@itemnumbers) {
331
    foreach my $itemnumber (@itemnumbers) {
332
        $canReserve = CanItemBeReserved( $borrowernumber, $itemnumber, $pickup_branchcode, $params );
332
        $canReserve = CanItemBeReserved( $borrowernumber, $itemnumber, $pickup_branchcode, $params );
333
        my $opacitemholds = $canReserve->{rights}->{opacitemholds};
333
        my $opacitemholds = $canReserve->{rights}->{opacitemholds} // 'Y';
334
        return { status => 'RecordHoldNotAllowed' } if $opacitemholds eq 'F';
334
        return { status => 'RecordHoldNotAllowed' } if $opacitemholds eq 'F';
335
        return { status => 'OK' } if ( $canReserve->{status} eq 'notReservable' && $opacitemholds eq 'N' );
335
        return { status => 'OK' } if ( $canReserve->{status} eq 'notReservable' && $opacitemholds eq 'N' );
336
        return { status => 'OK' } if $canReserve->{status} eq 'OK';
336
        return { status => 'OK' } if $canReserve->{status} eq 'OK';
Lines 370-375 sub CanItemBeReserved { Link Here
370
    my $holds_per_record = 1; # Total number of holds allowed for this one given record
370
    my $holds_per_record = 1; # Total number of holds allowed for this one given record
371
    my $holds_per_day;        # Default to unlimited
371
    my $holds_per_day;        # Default to unlimited
372
    my $opacitemholds = 'Y';  # Itemlevel holds default to allowed
372
    my $opacitemholds = 'Y';  # Itemlevel holds default to allowed
373
    my $context = $params->{context} // '';
373
374
374
    # we retrieve borrowers and items informations #
375
    # we retrieve borrowers and items informations #
375
    # item->{itype} will come for biblioitems if necessery
376
    # item->{itype} will come for biblioitems if necessery
Lines 436-442 sub CanItemBeReserved { Link Here
436
437
437
    my $holds = Koha::Holds->search($search_params);
438
    my $holds = Koha::Holds->search($search_params);
438
439
439
    if ( $opacitemholds eq "N" ) {
440
    if ( $opacitemholds eq "N" && $context ne 'staff' ) {
440
        return { status => "notReservable", rights => $rights };
441
        return { status => "notReservable", rights => $rights };
441
    }
442
    }
442
443
(-)a/reserve/placerequest.pl (-3 / +3 lines)
Lines 99-105 if ( $type eq 'str8' && $borrower ) { Link Here
99
                $biblionumber = $item->biblionumber;
99
                $biblionumber = $item->biblionumber;
100
            }
100
            }
101
101
102
            my $can_item_be_reserved = CanItemBeReserved($borrower->{'borrowernumber'}, $item->itemnumber, $branch)->{status};
102
            my $can_item_be_reserved = CanItemBeReserved($borrower->{'borrowernumber'}, $item->itemnumber, $branch, { context => 'staff' } )->{status};
103
103
104
            if ( $can_item_be_reserved eq 'OK' || ( $can_item_be_reserved ne 'itemAlreadyOnHold' && $can_override ) ) {
104
            if ( $can_item_be_reserved eq 'OK' || ( $can_item_be_reserved ne 'itemAlreadyOnHold' && $can_override ) ) {
105
                AddReserve(
105
                AddReserve(
Lines 123-129 if ( $type eq 'str8' && $borrower ) { Link Here
123
123
124
        } elsif (@biblionumbers > 1) {
124
        } elsif (@biblionumbers > 1) {
125
            my $bibinfo = $bibinfos{$biblionumber};
125
            my $bibinfo = $bibinfos{$biblionumber};
126
            if ( $can_override || CanBookBeReserved($borrower->{'borrowernumber'}, $biblionumber)->{status} eq 'OK' ) {
126
            if ( $can_override || CanBookBeReserved($borrower->{'borrowernumber'}, $biblionumber, undef, { context => 'staff' })->{status} eq 'OK' ) {
127
                AddReserve(
127
                AddReserve(
128
                    {
128
                    {
129
                        branchcode       => $branch,
129
                        branchcode       => $branch,
Lines 144-150 if ( $type eq 'str8' && $borrower ) { Link Here
144
        } else {
144
        } else {
145
            # place a request on 1st available
145
            # place a request on 1st available
146
            for ( my $i = 0 ; $i < $holds_to_place_count ; $i++ ) {
146
            for ( my $i = 0 ; $i < $holds_to_place_count ; $i++ ) {
147
                if ( $can_override || CanBookBeReserved($borrower->{'borrowernumber'}, $biblionumber)->{status} eq 'OK' ) {
147
                if ( $can_override || CanBookBeReserved($borrower->{'borrowernumber'}, $biblionumber, undef, { context => 'staff' })->{status} eq 'OK' ) {
148
                    AddReserve(
148
                    AddReserve(
149
                        {
149
                        {
150
                            branchcode       => $branch,
150
                            branchcode       => $branch,
(-)a/reserve/request.pl (-3 / +2 lines)
Lines 297-303 foreach my $biblionumber (@biblionumbers) { Link Here
297
    my $force_hold_level;
297
    my $force_hold_level;
298
    if ( $patron ) {
298
    if ( $patron ) {
299
        { # CanBookBeReserved
299
        { # CanBookBeReserved
300
            my $canReserve = CanBookBeReserved( $patron->borrowernumber, $biblionumber );
300
            my $canReserve = CanBookBeReserved( $patron->borrowernumber, $biblionumber, undef, { context => 'staff' });
301
            if ( $canReserve->{status} eq 'OK' ) {
301
            if ( $canReserve->{status} eq 'OK' ) {
302
302
303
                #All is OK and we can continue
303
                #All is OK and we can continue
Lines 557-563 foreach my $biblionumber (@biblionumbers) { Link Here
557
557
558
                $item->{'holdallowed'} = $branchitemrule->{'holdallowed'};
558
                $item->{'holdallowed'} = $branchitemrule->{'holdallowed'};
559
559
560
                my $can_item_be_reserved = CanItemBeReserved( $patron->borrowernumber, $itemnumber )->{status};
560
                my $can_item_be_reserved = CanItemBeReserved( $patron->borrowernumber, $itemnumber, undef, { context => 'staff'} )->{status};
561
                $item->{not_holdable} = $can_item_be_reserved unless ( $can_item_be_reserved eq 'OK' );
561
                $item->{not_holdable} = $can_item_be_reserved unless ( $can_item_be_reserved eq 'OK' );
562
562
563
                $item->{item_level_holds} = Koha::CirculationRules->get_opacitemholds_policy( { item => $item_object, patron => $patron } );
563
                $item->{item_level_holds} = Koha::CirculationRules->get_opacitemholds_policy( { item => $item_object, patron => $patron } );
564
- 

Return to bug 25408