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

(-)a/C4/Reserves.pm (-2 / +17 lines)
Lines 425-430 sub CanBookBeReserved{ Link Here
425
    my $patron = Koha::Patrons->find( $borrowernumber );
425
    my $patron = Koha::Patrons->find( $borrowernumber );
426
    while ( my $item = $items->next ) {
426
    while ( my $item = $items->next ) {
427
        $canReserve = CanItemBeReserved( $patron, $item, $pickup_branchcode, $params );
427
        $canReserve = CanItemBeReserved( $patron, $item, $pickup_branchcode, $params );
428
        if ( C4::Context->interface eq 'opac' ) {
429
            my $opacitemholds = Koha::CirculationRules->get_opacitemholds_policy(
430
                {
431
                    item   => $item,
432
                    patron => $patron
433
                }
434
            ) // 'Y';
435
            return { status => 'recordHoldNotAllowed' } if $opacitemholds eq 'F';
436
            return { status => 'OK' }                   if $canReserve->{status} eq 'recordHoldsOnly';
437
        }
428
        return { status => 'OK' } if $canReserve->{status} eq 'OK';
438
        return { status => 'OK' } if $canReserve->{status} eq 'OK';
429
    }
439
    }
430
    return $canReserve;
440
    return $canReserve;
Lines 551-560 sub CanItemBeReserved { Link Here
551
        categorycode => $borrower->{'categorycode'},
561
        categorycode => $borrower->{'categorycode'},
552
        itemtype     => $item->effective_itemtype,
562
        itemtype     => $item->effective_itemtype,
553
        branchcode   => $reserves_control_branch,
563
        branchcode   => $reserves_control_branch,
554
        rules        => ['holds_per_record','holds_per_day']
564
        rules        => ['holds_per_record','holds_per_day','opacitemholds']
555
    });
565
    });
556
    my $holds_per_record = $rights->{holds_per_record} // 1;
566
    my $holds_per_record = $rights->{holds_per_record} // 1;
557
    my $holds_per_day    = $rights->{holds_per_day};
567
    my $holds_per_day    = $rights->{holds_per_day};
568
    my $opacitemholds    = $rights->{opacitemholds} // 'Y';
558
569
559
    if (   defined $holds_per_record && $holds_per_record ne '' ){
570
    if (   defined $holds_per_record && $holds_per_record ne '' ){
560
        if ( $holds_per_record == 0 ) {
571
        if ( $holds_per_record == 0 ) {
Lines 691-696 sub CanItemBeReserved { Link Here
691
        }
702
        }
692
    }
703
    }
693
704
705
    if ( $opacitemholds eq "N" && C4::Context->interface eq 'opac' ) {
706
        return _cache { status => "recordHoldsOnly" };
707
    }
708
694
    return _cache { status => 'OK' };
709
    return _cache { status => 'OK' };
695
}
710
}
696
711
Lines 2021-2027 sub _ShiftPriority { Link Here
2021
    $sth = $dbh->prepare( $query );
2036
    $sth = $dbh->prepare( $query );
2022
    $sth->execute( $new_priority, $biblio );
2037
    $sth->execute( $new_priority, $biblio );
2023
    while ( my $row = $sth->fetchrow_hashref ) {
2038
    while ( my $row = $sth->fetchrow_hashref ) {
2024
	$sth_update->execute( $biblio, $row->{borrowernumber}, $row->{reservedate} );
2039
        $sth_update->execute( $biblio, $row->{borrowernumber}, $row->{reservedate} );
2025
    }
2040
    }
2026
2041
2027
    return $new_priority;  # so the caller knows what priority they wind up receiving
2042
    return $new_priority;  # so the caller knows what priority they wind up receiving
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-reserve.tt (-4 / +2 lines)
Lines 157-167 Link Here
157
                                [% IF bibitemloo.forced_hold_level %]
157
                                [% IF bibitemloo.forced_hold_level %]
158
                                    <div class="alert alert-info forced_hold_level">
158
                                    <div class="alert alert-info forced_hold_level">
159
                                        [% IF bibitemloo.forced_hold_level == 'item' %]
159
                                        [% IF bibitemloo.forced_hold_level == 'item' %]
160
                                            <span>You already have at least one item level hold on this title.
160
                                            <span>All further holds must be item level.</span>
161
                                            All further holds must be item level.</span>
162
                                        [% ELSE %]
161
                                        [% ELSE %]
163
                                            <span>You already have at least one record level hold on this title.
162
                                            <span>All further holds must be record level.</span>
164
                                            All further holds must be record level.</span>
165
                                        [% END %]
163
                                        [% END %]
166
                                    </div>
164
                                    </div>
167
                                [% END %]
165
                                [% END %]
(-)a/opac/opac-reserve.pl (-15 / +25 lines)
Lines 481-499 foreach my $biblioNum (@biblionumbers) { Link Here
481
481
482
        my $branch = Koha::Policy::Holds->holds_control_library( $item, $patron );
482
        my $branch = Koha::Policy::Holds->holds_control_library( $item, $patron );
483
483
484
        my $policy_holdallowed =
484
        my $item_status = CanItemBeReserved( $patron, $item, undef, { get_from_cache => 1 } )->{status};
485
            CanItemBeReserved( $patron, $item, undef, { get_from_cache => 1 } )->{status} eq 'OK' &&
485
486
            IsAvailableForItemLevelRequest($item, $patron, undef);
486
        if ( $item_status eq 'recordHoldsOnly' ) {
487
            $biblioLoopIter{force_hold}        = 1;
488
            $biblioLoopIter{itemholdable}      = 0;
489
            $biblioLoopIter{forced_hold_level} = 'record';
490
        }
491
492
        my $policy_holdallowed = IsAvailableForItemLevelRequest( $item, $patron, undef )
493
            && ( $item_status eq 'OK' or $item_status eq 'recordHoldsOnly' );
487
494
488
        if ($policy_holdallowed) {
495
        if ($policy_holdallowed) {
489
            my $opac_hold_policy = Koha::CirculationRules->get_opacitemholds_policy( { item => $item, patron => $patron } );
496
            $numCopiesAvailable++;
490
            if ( $opac_hold_policy ne 'N' ) { # If Y or F
497
            if ( $item_status ne 'recordHoldsOnly' ) {
491
                $item_info->{available} = 1;
492
                $numCopiesOPACAvailable++;
498
                $numCopiesOPACAvailable++;
493
                $biblioLoopIter{force_hold} = 1 if $opac_hold_policy eq 'F';
499
                $item_info->{available} = 1;
494
            }
500
            }
495
            $numCopiesAvailable++;
496
497
            unless ( $can_place_hold_if_available_at_pickup ) {
501
            unless ( $can_place_hold_if_available_at_pickup ) {
498
                my $items_in_this_library = Koha::Items->search({ biblionumber => $item->biblionumber, holdingbranch => $item->holdingbranch, notforloan => 0 });
502
                my $items_in_this_library = Koha::Items->search({ biblionumber => $item->biblionumber, holdingbranch => $item->holdingbranch, notforloan => 0 });
499
                my $nb_of_items_issued = $items_in_this_library->search({ 'issue.itemnumber' => { not => undef }}, { join => 'issue' })->count;
503
                my $nb_of_items_issued = $items_in_this_library->search({ 'issue.itemnumber' => { not => undef }}, { join => 'issue' })->count;
Lines 543-551 foreach my $biblioNum (@biblionumbers) { Link Here
543
        }
547
        }
544
    }
548
    }
545
549
546
    my $status = CanBookBeReserved( $borrowernumber, $biblioNum )->{status};
550
    my $record_status = CanBookBeReserved( $borrowernumber, $biblioNum )->{status};
547
    $biblioLoopIter{holdable} &&= $status eq 'OK';
551
    if ($record_status eq 'recordHoldNotAllowed') {
548
    $biblioLoopIter{$status} = 1;
552
        $biblioLoopIter{force_hold} = 1;
553
        $biblioLoopIter{itemholdable} = 1;
554
        $biblioLoopIter{forced_hold_level} = 'item';
555
        $biblioLoopIter{holdable} &&= 1;
556
    }
557
    else {
558
        $biblioLoopIter{holdable} &&= $record_status eq 'OK';
559
    }
549
560
550
    if ( $biblioLoopIter{holdable} and C4::Context->preference('AllowHoldItemTypeSelection') ) {
561
    if ( $biblioLoopIter{holdable} and C4::Context->preference('AllowHoldItemTypeSelection') ) {
551
        # build the allowed item types loop
562
        # build the allowed item types loop
Lines 563-569 foreach my $biblioNum (@biblionumbers) { Link Here
563
        $biblioLoopIter{allowed_item_types} = \@item_types;
574
        $biblioLoopIter{allowed_item_types} = \@item_types;
564
    }
575
    }
565
576
566
    if ( $status eq 'recall' ) {
577
    if ( $record_status eq 'recall' ) {
567
        $biblioLoopIter{recall} = 1;
578
        $biblioLoopIter{recall} = 1;
568
    }
579
    }
569
580
Lines 623-629 if ( Link Here
623
    C4::Context->preference( 'OPACAllowHoldDateInFuture' )
634
    C4::Context->preference( 'OPACAllowHoldDateInFuture' )
624
    ) {
635
    ) {
625
    $template->param(
636
    $template->param(
626
	    reserve_in_future         => 1,
637
            reserve_in_future         => 1,
627
    );
638
    );
628
}
639
}
629
640
630
- 

Return to bug 25408