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

(-)a/C4/Reserves.pm (-2 / +11 lines)
Lines 335-343 sub CanBookBeReserved{ Link Here
335
    }
335
    }
336
336
337
    my $canReserve = { status => '' };
337
    my $canReserve = { status => '' };
338
338
    foreach my $itemnumber (@itemnumbers) {
339
    foreach my $itemnumber (@itemnumbers) {
339
        $canReserve = CanItemBeReserved( $borrowernumber, $itemnumber, $pickup_branchcode, $params );
340
        $canReserve = CanItemBeReserved( $borrowernumber, $itemnumber, $pickup_branchcode, $params );
341
        my $opacitemholds = $canReserve->{rights}->{opacitemholds} // 'Y';
342
        return { status => 'recordHoldNotAllowed' } if $opacitemholds eq 'F';
340
        return { status => 'OK' } if $canReserve->{status} eq 'OK';
343
        return { status => 'OK' } if $canReserve->{status} eq 'OK';
344
        return { status => 'OK' } if $canReserve->{status} eq 'recordHoldsOnly';
341
    }
345
    }
342
    return $canReserve;
346
    return $canReserve;
343
}
347
}
Lines 445-454 sub CanItemBeReserved { Link Here
445
        categorycode => $borrower->{'categorycode'},
449
        categorycode => $borrower->{'categorycode'},
446
        itemtype     => $item->effective_itemtype,
450
        itemtype     => $item->effective_itemtype,
447
        branchcode   => $branchcode,
451
        branchcode   => $branchcode,
448
        rules        => ['holds_per_record','holds_per_day']
452
        rules        => ['holds_per_record','holds_per_day','opacitemholds']
449
    });
453
    });
450
    my $holds_per_record = $rights->{holds_per_record} // 1;
454
    my $holds_per_record = $rights->{holds_per_record} // 1;
451
    my $holds_per_day    = $rights->{holds_per_day};
455
    my $holds_per_day    = $rights->{holds_per_day};
456
    my $opacitemholds    = $rights->{opacitemholds} // 'Y';
452
457
453
    my $search_params = {
458
    my $search_params = {
454
        borrowernumber => $borrowernumber,
459
        borrowernumber => $borrowernumber,
Lines 585-591 sub CanItemBeReserved { Link Here
585
        }
590
        }
586
    }
591
    }
587
592
588
    return { status => 'OK' };
593
    if ( $opacitemholds eq "N" && C4::Context->interface eq 'opac') {
594
        return { status => "recordHoldsOnly", rights => $rights };
595
    }
596
597
    return { status => 'OK', rights => $rights };
589
}
598
}
590
599
591
=head2 CanReserveBeCanceledFromOpac
600
=head2 CanReserveBeCanceledFromOpac
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt (-2 / +4 lines)
Lines 333-339 Link Here
333
                    </div>
333
                    </div>
334
                [% END %]
334
                [% END %]
335
335
336
                [% IF ( no_reserves_allowed || exceeded_maxreserves || exceeded_holds_per_record || alreadyreserved || none_available || alreadypossession || ageRestricted ) %]
336
                [% IF ( no_reserves_allowed || exceeded_maxreserves || exceeded_holds_per_record || alreadyreserved || none_available || alreadypossession || ageRestricted || recordHoldNotAllowed ) %]
337
                    <div class="dialog alert">
337
                    <div class="dialog alert">
338
338
339
                        [% UNLESS ( multi_hold ) %]
339
                        [% UNLESS ( multi_hold ) %]
Lines 355-360 Link Here
355
                                    <li> <strong>No items are available</strong> to be placed on hold.</li>
355
                                    <li> <strong>No items are available</strong> to be placed on hold.</li>
356
                                [% ELSIF ( maxreserves ) %]
356
                                [% ELSIF ( maxreserves ) %]
357
                                    <li><strong>Too many holds: </strong> <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% patron.borrowernumber | uri %]">[% patron.firstname | html %] [% patron.surname | html %] </a> has too many holds.</li>
357
                                    <li><strong>Too many holds: </strong> <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% patron.borrowernumber | uri %]">[% patron.firstname | html %] [% patron.surname | html %] </a> has too many holds.</li>
358
                                [% ELSIF ( recordHoldNotAllowed ) %]
359
                                    <li><strong>Record holds not allowed : </strong> <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% patron.borrowernumber | uri %]">[% patron.firstname | html %] [% patron.surname | html %] </a> cannot put a record-level hold on this ressource.</li>
358
                                [% END # /IF exceeded_maxreserves %]
360
                                [% END # /IF exceeded_maxreserves %]
359
                            </ul>
361
                            </ul>
360
                        [% ELSE # UNLESS multi_hold %]
362
                        [% ELSE # UNLESS multi_hold %]
Lines 531-537 Link Here
531
                                [% IF ( patron.borrowernumber ) %]
533
                                [% IF ( patron.borrowernumber ) %]
532
                                    [% IF ( override_required ) %]
534
                                    [% IF ( override_required ) %]
533
                                        <button type="submit" class="btn btn-default warning"><i class="fa fa-exclamation-triangle "></i> Place hold</button>
535
                                        <button type="submit" class="btn btn-default warning"><i class="fa fa-exclamation-triangle "></i> Place hold</button>
534
                                    [% ELSIF ( none_available ) %]
536
                                    [% ELSIF ( none_available || recordHoldNotAllowed ) %]
535
                                        <button type="submit" disabled="disabled" class="btn btn-default btn-disabled">Place hold</button>
537
                                        <button type="submit" disabled="disabled" class="btn btn-default btn-disabled">Place hold</button>
536
                                    [% ELSE %]
538
                                    [% ELSE %]
537
                                        <button type="submit" class="btn btn-default">Place hold</button>
539
                                        <button type="submit" class="btn btn-default">Place hold</button>
(-)a/reserve/placerequest.pl (-1 / +1 lines)
Lines 145-151 if ( $type eq 'str8' && $borrower ) { Link Here
145
        } else {
145
        } else {
146
            # place a request on 1st available
146
            # place a request on 1st available
147
            for ( my $i = 0 ; $i < $holds_to_place_count ; $i++ ) {
147
            for ( my $i = 0 ; $i < $holds_to_place_count ; $i++ ) {
148
                if ( $can_override || CanBookBeReserved($borrower->{'borrowernumber'}, $biblionumber)->{status} eq 'OK' ) {
148
                if ( $can_override || CanBookBeReserved($borrower->{'borrowernumber'}, $biblionumber, undef, { context => 'staff' })->{status} eq 'OK' ) {
149
                    AddReserve(
149
                    AddReserve(
150
                        {
150
                        {
151
                            branchcode       => $branch,
151
                            branchcode       => $branch,
(-)a/reserve/request.pl (-1 / +4 lines)
Lines 337-342 foreach my $biblionumber (@biblionumbers) { Link Here
337
                $template->param( $canReserve->{status} => 1);
337
                $template->param( $canReserve->{status} => 1);
338
                $biblioloopiter{ $canReserve->{status} } = 1;
338
                $biblioloopiter{ $canReserve->{status} } = 1;
339
            }
339
            }
340
            elsif ( $canReserve->{status} eq 'recordHoldNotAllowed' ) {
341
                $template->param( $canReserve->{status} => 1 );
342
                $biblioloopiter{ $canReserve->{status} } = 1;
343
            }
340
            else {
344
            else {
341
                $biblioloopiter{ $canReserve->{status} } = 1;
345
                $biblioloopiter{ $canReserve->{status} } = 1;
342
            }
346
            }
343
- 

Return to bug 25408