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

(-)a/C4/Reserves.pm (-1 / +1 lines)
Lines 1404-1410 sub IsAvailableForItemLevelRequest { Link Here
1404
        my $any_available = ItemsAnyAvailableAndNotRestricted( { biblionumber => $item->biblionumber, patron => $patron });
1404
        my $any_available = ItemsAnyAvailableAndNotRestricted( { biblionumber => $item->biblionumber, patron => $patron });
1405
        return $any_available ? 0 : 1;
1405
        return $any_available ? 0 : 1;
1406
    } else { # on_shelf_holds == 0 "If any unavailable" (the description is rather cryptic and could still be improved)
1406
    } else { # on_shelf_holds == 0 "If any unavailable" (the description is rather cryptic and could still be improved)
1407
        return $item->onloan || IsItemOnHoldAndFound( $item->itemnumber );
1407
        return $item->notforloan < 0 || $item->onloan || IsItemOnHoldAndFound( $item->itemnumber );
1408
    }
1408
    }
1409
}
1409
}
1410
1410
(-)a/opac/opac-ISBDdetail.pl (-5 / +4 lines)
Lines 52-58 use C4::Biblio qw( Link Here
52
    GetMarcISSN
52
    GetMarcISSN
53
    TransformMarcToKoha
53
    TransformMarcToKoha
54
);
54
);
55
use C4::Reserves;
55
use C4::Reserves qw( IsAvailableForItemLevelRequest );
56
use C4::Serials qw( CountSubscriptionFromBiblionumber SearchSubscriptions GetLatestSerials );
56
use C4::Serials qw( CountSubscriptionFromBiblionumber SearchSubscriptions GetLatestSerials );
57
use C4::Koha qw(
57
use C4::Koha qw(
58
    GetNormalizedEAN
58
    GetNormalizedEAN
Lines 168-174 $template->param( Link Here
168
    subscriptionsnumber => $subscriptionsnumber,
168
    subscriptionsnumber => $subscriptionsnumber,
169
);
169
);
170
170
171
my $allow_onshelf_holds;
171
my $can_item_be_reserved = 0;
172
my $res = GetISBDView({
172
my $res = GetISBDView({
173
    'record'    => $record,
173
    'record'    => $record,
174
    'template'  => 'opac',
174
    'template'  => 'opac',
Lines 178-188 my $res = GetISBDView({ Link Here
178
my $items = $biblio->items;
178
my $items = $biblio->items;
179
while ( my $item = $items->next ) {
179
while ( my $item = $items->next ) {
180
180
181
    $allow_onshelf_holds = Koha::CirculationRules->get_onshelfholds_policy( { item => $item, patron => $patron } )
181
    $can_item_be_reserved = $can_item_be_reserved || IsAvailableForItemLevelRequest($item, $patron, undef);
182
      unless $allow_onshelf_holds;
183
}
182
}
184
183
185
if( $allow_onshelf_holds || CountItemsIssued($biblionumber) || $biblio->has_items_waiting_or_intransit ) {
184
if( $can_item_be_reserved || CountItemsIssued($biblionumber) || $biblio->has_items_waiting_or_intransit ) {
186
    $template->param( ReservableItems => 1 );
185
    $template->param( ReservableItems => 1 );
187
}
186
}
188
187
(-)a/opac/opac-MARCdetail.pl (-5 / +16 lines)
Lines 58-64 use C4::Biblio qw( Link Here
58
    GetMarcStructure
58
    GetMarcStructure
59
    TransformMarcToKoha
59
    TransformMarcToKoha
60
);
60
);
61
use C4::Reserves;
61
use C4::Reserves qw( IsAvailableForItemLevelRequest CanBookBeReserved );
62
use C4::Members;
62
use C4::Members;
63
use C4::Koha qw( GetNormalizedISBN );
63
use C4::Koha qw( GetNormalizedISBN );
64
use List::MoreUtils qw( uniq );
64
use List::MoreUtils qw( uniq );
Lines 136-150 $template->param( Link Here
136
) if $tagslib->{$bt_tag}->{$bt_subtag}->{hidden} <= 0 && # <=0 OPAC visible.
136
) if $tagslib->{$bt_tag}->{$bt_subtag}->{hidden} <= 0 && # <=0 OPAC visible.
137
     $tagslib->{$bt_tag}->{$bt_subtag}->{hidden} > -8;   # except -8;
137
     $tagslib->{$bt_tag}->{$bt_subtag}->{hidden} > -8;   # except -8;
138
138
139
my $allow_onshelf_holds;
139
my $currentbranch = C4::Context->userenv ? C4::Context->userenv->{branch} : undef;
140
my $is_available;
140
$items->reset;
141
$items->reset;
141
142
142
while ( my $item = $items->next ) {
143
while ( my $item = $items->next ) {
143
    $allow_onshelf_holds = Koha::CirculationRules->get_onshelfholds_policy( { item => $item, patron => $patron } )
144
    my $default_hold_pickup_location_pref = C4::Context->preference('DefaultHoldPickupLocation');
144
      unless $allow_onshelf_holds;
145
    my $pickup_branch;
146
    if( $default_hold_pickup_location_pref eq 'homebranch' ){
147
        $pickup_branch = $item->{homebranch} ? $item->{homebranch} : undef;
148
    } elsif ( $default_hold_pickup_location_pref eq 'holdingbranch' ){
149
        $pickup_branch = $item->{holdingbranch} ? $item->{holdingbranch} : undef;
150
    } else {
151
        $pickup_branch = $currentbranch;
152
    }
153
    $is_available = IsAvailableForItemLevelRequest($item, $patron, $pickup_branch)
154
      unless $is_available;
145
}
155
}
146
156
147
if( $allow_onshelf_holds || CountItemsIssued($biblionumber) || $biblio->has_items_waiting_or_intransit ) {
157
my $canReserve = CanBookBeReserved($loggedinuser, $biblionumber, $currentbranch);
158
if (!$loggedinuser || ($canReserve->{status} eq "OK" && $is_available)) {
148
    $template->param( ReservableItems => 1 );
159
    $template->param( ReservableItems => 1 );
149
}
160
}
150
161
(-)a/opac/opac-detail.pl (-7 / +4 lines)
Lines 60-66 use C4::External::Syndetics qw( Link Here
60
use C4::Members;
60
use C4::Members;
61
use C4::XSLT qw( XSLTParse4Display );
61
use C4::XSLT qw( XSLTParse4Display );
62
use C4::ShelfBrowser qw( GetNearbyItems );
62
use C4::ShelfBrowser qw( GetNearbyItems );
63
use C4::Reserves qw( GetReserveStatus );
63
use C4::Reserves qw( GetReserveStatus IsAvailableForItemLevelRequest );
64
use C4::Charset qw( SetUTF8Flag );
64
use C4::Charset qw( SetUTF8Flag );
65
use MARC::Field;
65
use MARC::Field;
66
use List::MoreUtils qw( any );
66
use List::MoreUtils qw( any );
Lines 658-664 if ( C4::Context->preference('OPACAcquisitionDetails' ) ) { Link Here
658
    };
658
    };
659
}
659
}
660
660
661
my $allow_onshelf_holds;
661
my $can_item_be_reserved = 0;
662
my ( $itemloop_has_images, $otheritemloop_has_images );
662
my ( $itemloop_has_images, $otheritemloop_has_images );
663
if ( not $viewallitems and $items->count > $max_items_to_display ) {
663
if ( not $viewallitems and $items->count > $max_items_to_display ) {
664
    $template->param(
664
    $template->param(
Lines 682-690 else { Link Here
682
        $item_info->{holding_library_info} = $opac_info_holding->content if $opac_info_holding;
682
        $item_info->{holding_library_info} = $opac_info_holding->content if $opac_info_holding;
683
        $item_info->{home_library_info} = $opac_info_home->content if $opac_info_home;
683
        $item_info->{home_library_info} = $opac_info_home->content if $opac_info_home;
684
684
685
        $allow_onshelf_holds = Koha::CirculationRules->get_onshelfholds_policy(
685
        $can_item_be_reserved = $can_item_be_reserved || IsAvailableForItemLevelRequest($item, $patron, undef);
686
            { item => $item, patron => $patron } )
687
          unless $allow_onshelf_holds;
688
686
689
        # get collection code description, too
687
        # get collection code description, too
690
        my $ccode = $item->ccode;
688
        my $ccode = $item->ccode;
Lines 759-765 else { Link Here
759
    }
757
    }
760
}
758
}
761
759
762
if( $allow_onshelf_holds || CountItemsIssued($biblionumber) || $biblio->has_items_waiting_or_intransit ) {
760
if( $can_item_be_reserved || CountItemsIssued($biblionumber) || $biblio->has_items_waiting_or_intransit ) {
763
    $template->param( ReservableItems => 1 );
761
    $template->param( ReservableItems => 1 );
764
}
762
}
765
763
766
- 

Return to bug 30556