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

(-)a/opac/opac-ISBDdetail.pl (-5 / +7 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 CanBookBeReserved );
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 $currentbranch = C4::Context->userenv ? C4::Context->userenv->{branch} : undef;
172
my $is_available;
172
my $res = GetISBDView({
173
my $res = GetISBDView({
173
    'record'    => $record,
174
    'record'    => $record,
174
    'template'  => 'opac',
175
    'template'  => 'opac',
Lines 178-188 my $res = GetISBDView({ Link Here
178
my $items = $biblio->items;
179
my $items = $biblio->items;
179
while ( my $item = $items->next ) {
180
while ( my $item = $items->next ) {
180
181
181
    $allow_onshelf_holds = Koha::CirculationRules->get_onshelfholds_policy( { item => $item, patron => $patron } )
182
    $is_available = IsAvailableForItemLevelRequest($item, $patron, $currentbranch)
182
      unless $allow_onshelf_holds;
183
      unless $is_available;
183
}
184
}
184
185
185
if( $allow_onshelf_holds || CountItemsIssued($biblionumber) || $biblio->has_items_waiting_or_intransit ) {
186
my $canReserve = CanBookBeReserved($loggedinuser, $biblionumber, $currentbranch);
187
if (!$loggedinuser || ($canReserve->{status} eq "OK" && $is_available)) {
186
    $template->param( ReservableItems => 1 );
188
    $template->param( ReservableItems => 1 );
187
}
189
}
188
190
(-)a/opac/opac-MARCdetail.pl (-5 / +7 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 139-153 $template->param( Link Here
139
) if $tagslib->{$bt_tag}->{$bt_subtag}->{hidden} <= 0 && # <=0 OPAC visible.
139
) if $tagslib->{$bt_tag}->{$bt_subtag}->{hidden} <= 0 && # <=0 OPAC visible.
140
     $tagslib->{$bt_tag}->{$bt_subtag}->{hidden} > -8;   # except -8;
140
     $tagslib->{$bt_tag}->{$bt_subtag}->{hidden} > -8;   # except -8;
141
141
142
my $allow_onshelf_holds;
142
my $currentbranch = C4::Context->userenv ? C4::Context->userenv->{branch} : undef;
143
my $is_available;
143
my $items = $biblio->items;
144
my $items = $biblio->items;
144
145
145
while ( my $item = $items->next ) {
146
while ( my $item = $items->next ) {
146
    $allow_onshelf_holds = Koha::CirculationRules->get_onshelfholds_policy( { item => $item, patron => $patron } )
147
    $is_available = IsAvailableForItemLevelRequest($item, $patron, $currentbranch)
147
      unless $allow_onshelf_holds;
148
      unless $is_available;
148
}
149
}
149
150
150
if( $allow_onshelf_holds || CountItemsIssued($biblionumber) || $biblio->has_items_waiting_or_intransit ) {
151
my $canReserve = CanBookBeReserved($loggedinuser, $biblionumber, $currentbranch);
152
if (!$loggedinuser || ($canReserve->{status} eq "OK" && $is_available)) {
151
    $template->param( ReservableItems => 1 );
153
    $template->param( ReservableItems => 1 );
152
}
154
}
153
155
(-)a/opac/opac-detail.pl (-7 / +6 lines)
Lines 61-67 use C4::External::Syndetics qw( Link Here
61
use C4::Members;
61
use C4::Members;
62
use C4::XSLT qw( XSLTParse4Display );
62
use C4::XSLT qw( XSLTParse4Display );
63
use C4::ShelfBrowser qw( GetNearbyItems );
63
use C4::ShelfBrowser qw( GetNearbyItems );
64
use C4::Reserves qw( GetReserveStatus );
64
use C4::Reserves qw( GetReserveStatus IsAvailableForItemLevelRequest CanBookBeReserved );
65
use C4::Charset qw( SetUTF8Flag );
65
use C4::Charset qw( SetUTF8Flag );
66
use MARC::Field;
66
use MARC::Field;
67
use List::MoreUtils qw( any );
67
use List::MoreUtils qw( any );
Lines 671-677 if ( C4::Context->preference('OPACAcquisitionDetails' ) ) { Link Here
671
    };
671
    };
672
}
672
}
673
673
674
my $allow_onshelf_holds;
674
my $is_available;
675
my ( $itemloop_has_images, $otheritemloop_has_images );
675
my ( $itemloop_has_images, $otheritemloop_has_images );
676
if ( not $viewallitems and $items->count > $max_items_to_display ) {
676
if ( not $viewallitems and $items->count > $max_items_to_display ) {
677
    $template->param(
677
    $template->param(
Lines 685-693 else { Link Here
685
        $item->{holds_count} = $item_reserves{ $item->itemnumber };
685
        $item->{holds_count} = $item_reserves{ $item->itemnumber };
686
        $item->{priority}    = $priority{ $item->itemnumber };
686
        $item->{priority}    = $priority{ $item->itemnumber };
687
687
688
        $allow_onshelf_holds = Koha::CirculationRules->get_onshelfholds_policy(
688
        $is_available = IsAvailableForItemLevelRequest($item, $patron, $currentbranch)
689
            { item => $item, patron => $patron } )
689
          unless $is_available;
690
          unless $allow_onshelf_holds;
691
690
692
        # get collection code description, too
691
        # get collection code description, too
693
        my $ccode = $item->ccode;
692
        my $ccode = $item->ccode;
Lines 783-789 else { Link Here
783
    }
782
    }
784
}
783
}
785
784
786
if( $allow_onshelf_holds || CountItemsIssued($biblionumber) || $biblio->has_items_waiting_or_intransit ) {
785
my $canReserve = CanBookBeReserved($borrowernumber, $biblionumber, $currentbranch);
786
if (!$borrowernumber || ($canReserve->{status} eq "OK" && $is_available)) {
787
    $template->param( ReservableItems => 1 );
787
    $template->param( ReservableItems => 1 );
788
}
788
}
789
789
790
- 

Return to bug 30556