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

(-)a/C4/Reserves.pm (-2 / +12 lines)
Lines 340-345 sub CanBookBeReserved{ Link Here
340
    my $canReserve = { status => '' };
340
    my $canReserve = { status => '' };
341
    foreach my $itemnumber (@itemnumbers) {
341
    foreach my $itemnumber (@itemnumbers) {
342
        $canReserve = CanItemBeReserved( $borrowernumber, $itemnumber, $pickup_branchcode, $params );
342
        $canReserve = CanItemBeReserved( $borrowernumber, $itemnumber, $pickup_branchcode, $params );
343
        if ( C4::Context->interface eq 'opac' ) {
344
            my $opacitemholds = $canReserve->{rights}->{opacitemholds} // 'Y';
345
            return { status => 'recordHoldNotAllowed' } if $opacitemholds eq 'F';
346
            return { status => 'OK' } if $canReserve->{status} eq 'recordHoldsOnly';
347
        }
343
        return { status => 'OK' } if $canReserve->{status} eq 'OK';
348
        return { status => 'OK' } if $canReserve->{status} eq 'OK';
344
    }
349
    }
345
    return $canReserve;
350
    return $canReserve;
Lines 448-457 sub CanItemBeReserved { Link Here
448
        categorycode => $borrower->{'categorycode'},
453
        categorycode => $borrower->{'categorycode'},
449
        itemtype     => $item->effective_itemtype,
454
        itemtype     => $item->effective_itemtype,
450
        branchcode   => $branchcode,
455
        branchcode   => $branchcode,
451
        rules        => ['holds_per_record','holds_per_day']
456
        rules        => ['holds_per_record','holds_per_day','opacitemholds']
452
    });
457
    });
453
    my $holds_per_record = $rights->{holds_per_record} // 1;
458
    my $holds_per_record = $rights->{holds_per_record} // 1;
454
    my $holds_per_day    = $rights->{holds_per_day};
459
    my $holds_per_day    = $rights->{holds_per_day};
460
    my $opacitemholds    = $rights->{opacitemholds} // 'Y';
455
461
456
    my $search_params = {
462
    my $search_params = {
457
        borrowernumber => $borrowernumber,
463
        borrowernumber => $borrowernumber,
Lines 588-594 sub CanItemBeReserved { Link Here
588
        }
594
        }
589
    }
595
    }
590
596
591
    return { status => 'OK' };
597
    if ( $opacitemholds eq "N" && C4::Context->interface eq 'opac') {
598
        return { status => "recordHoldsOnly", rights => $rights };
599
    }
600
601
    return { status => 'OK', rights => $rights };
592
}
602
}
593
603
594
=head2 CanReserveBeCanceledFromOpac
604
=head2 CanReserveBeCanceledFromOpac
(-)a/t/db_dependent/Reserves.t (-2 / +1 lines)
Lines 1083-1089 subtest 'reserves.item_level_hold' => sub { Link Here
1083
    subtest 'test opacitemholds rules in staff context' => sub {
1083
    subtest 'test opacitemholds rules in staff context' => sub {
1084
        plan tests => 2;
1084
        plan tests => 2;
1085
1085
1086
	C4::Context->interface('intranet');
1086
        C4::Context->interface('intranet');
1087
        Koha::CirculationRules->set_rules(
1087
        Koha::CirculationRules->set_rules(
1088
            {
1088
            {
1089
                branchcode   => undef,
1089
                branchcode   => undef,
1090
- 

Return to bug 25408