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

(-)a/koha-tmpl/opac-tmpl/bootstrap/en/includes/opac-detail-sidebar.inc (-6 / +4 lines)
Lines 1-12 Link Here
1
[% USE raw %]
1
[% USE raw %]
2
[% USE Biblio %]
2
[% USE Biblio %]
3
<ul id="action">
3
<ul id="action">
4
    [% UNLESS ( norequests ) %]
4
    [% IF Koha.Preference( 'opacuserlogin' ) == 1 %]
5
        [% IF Koha.Preference( 'opacuserlogin' ) == 1 %]
5
        [% IF Koha.Preference( 'OPACHoldRequests' ) == 1 %]
6
            [% IF Koha.Preference( 'OPACHoldRequests' ) == 1 %]
6
            [% IF ( ReservableItems ) %]
7
                [% IF ( ReservableItems ) %]
7
                <li><a class="reserve btn btn-link btn-lg" href="/cgi-bin/koha/opac-reserve.pl?biblionumber=[% biblio.biblionumber | html %]"><i class="fa fa-fw fa-bookmark" aria-hidden="true"></i> Place hold</a></li>
8
                    <li><a class="reserve btn btn-link btn-lg" href="/cgi-bin/koha/opac-reserve.pl?biblionumber=[% biblio.biblionumber | html %]"><i class="fa fa-fw fa-bookmark" aria-hidden="true"></i> Place hold</a></li>
9
                [% END %]
10
            [% END %]
8
            [% END %]
11
        [% END %]
9
        [% END %]
12
    [% END %]
10
    [% END %]
(-)a/opac/opac-ISBDdetail.pl (-13 / +13 lines)
Lines 168-196 $template->param( Link Here
168
    subscriptionsnumber => $subscriptionsnumber,
168
    subscriptionsnumber => $subscriptionsnumber,
169
);
169
);
170
170
171
my $can_item_be_reserved = 0;
172
my $res = GetISBDView({
171
my $res = GetISBDView({
173
    'record'    => $record,
172
    'record'    => $record,
174
    'template'  => 'opac',
173
    'template'  => 'opac',
175
    'framework' => $biblio->frameworkcode
174
    'framework' => $biblio->frameworkcode
176
});
175
});
177
176
178
my $items = $biblio->items;
177
# Count the number of items that allow holds at the 'All libraries' rule level
179
while ( my $item = $items->next ) {
178
my $holdable_items = $biblio->items->filter_by_for_hold->count;
180
179
181
    $can_item_be_reserved = $can_item_be_reserved || $patron && IsAvailableForItemLevelRequest( $item, $patron, undef );
180
# If we have a patron we need to check their policies for holds in the loop below
182
}
181
# If we don't have a patron, then holdable items determines holdability
183
182
my $can_holds_be_placed = $patron ? 0 : $holdable_items;
184
if( $can_item_be_reserved || CountItemsIssued($biblionumber) || $biblio->has_items_waiting_or_intransit ) {
183
if ($patron) {
185
    $template->param( ReservableItems => 1 );
184
    my $items = $biblio->items;
185
    while ( my $item = $items->next ) {
186
        $can_holds_be_placed = $can_holds_be_placed || IsAvailableForItemLevelRequest( $item, $patron, undef );
187
    }
186
}
188
}
187
189
188
my $norequests = ! $items->filter_by_for_hold->count;
189
190
$template->param(
190
$template->param(
191
    norequests   => $norequests,
191
    ReservableItems => $can_holds_be_placed,
192
    ISBD         => $res,
192
    ISBD            => $res,
193
    biblio       => $biblio,
193
    biblio          => $biblio,
194
);
194
);
195
195
196
#Search for title in links
196
#Search for title in links
(-)a/opac/opac-MARCdetail.pl (-7 / +12 lines)
Lines 136-152 $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 $can_item_be_reserved = 0;
139
# Count the number of items that allow holds at the 'All libraries' rule level
140
$items->reset;
140
my $holdable_items = $biblio->items->filter_by_for_hold->count;
141
141
142
while ( my $item = $items->next ) {
142
# If we have a patron we need to check their policies for holds in the loop below
143
    $can_item_be_reserved = $can_item_be_reserved || $patron && IsAvailableForItemLevelRequest( $item, $patron, undef );
143
# If we don't have a patron, then holdable items determines holdability
144
}
144
my $can_holds_be_placed = $patron ? 0 : $holdable_items;
145
145
146
if( $can_item_be_reserved || CountItemsIssued($biblionumber) || $biblio->has_items_waiting_or_intransit ) {
146
if ($patron) {
147
    $template->param( ReservableItems => 1 );
147
    $items->reset;
148
    while ( my $item = $items->next ) {
149
        $can_holds_be_placed = $can_holds_be_placed || IsAvailableForItemLevelRequest( $item, $patron, undef );
150
    }
148
}
151
}
149
152
153
$template->param( ReservableItems => $can_holds_be_placed );
154
150
# fill arrays
155
# fill arrays
151
my @loop_data = ();
156
my @loop_data = ();
152
157
(-)a/opac/opac-detail.pl (-12 / +9 lines)
Lines 662-673 if ( C4::Context->preference('OPACAcquisitionDetails' ) ) { Link Here
662
    };
662
    };
663
}
663
}
664
664
665
# Count the number of items that allow holds
665
# Count the number of items that allow holds at the 'All libraries' rule level
666
my $holdable_items = $biblio->items->filter_by_for_hold->count;
666
my $holdable_items = $biblio->items->filter_by_for_hold->count;
667
# If we have a patron and there are no holdable items - we set to no
667
668
# If we have a patron and there are holdable items we set to no - and we need to check each item specifically
668
# If we have a patron we need to check their policies for holds in the loop below
669
# If we don't have a patron, then holdable items determines holdability
669
# If we don't have a patron, then holdable items determines holdability
670
my $can_holds_be_placed = $patron && $holdable_items ? 0 : $holdable_items;
670
my $can_holds_be_placed = $patron ? 0 : $holdable_items;
671
671
672
my ( $itemloop_has_images, $otheritemloop_has_images );
672
my ( $itemloop_has_images, $otheritemloop_has_images );
673
if ( not $viewallitems and $items->count > $max_items_to_display ) {
673
if ( not $viewallitems and $items->count > $max_items_to_display ) {
Lines 692-702 else { Link Here
692
        $item_info->{holding_library_info} = $opac_info_holding->content if $opac_info_holding;
692
        $item_info->{holding_library_info} = $opac_info_holding->content if $opac_info_holding;
693
        $item_info->{home_library_info} = $opac_info_home->content if $opac_info_home;
693
        $item_info->{home_library_info} = $opac_info_home->content if $opac_info_home;
694
694
695
        # We only need to check if we haven't determined holds can be place, and there are items that can
695
        # We only need to check if we haven't determined holds can be placed
696
        # be held, and we have a patron to determine holdability
696
        # and if we don't have patron, we have already decided
697
        if( !$can_holds_be_placed && $holdable_items && $patron ){
697
        $can_holds_be_placed =
698
            $can_holds_be_placed = IsAvailableForItemLevelRequest($item, $patron, undef);
698
            $can_holds_be_placed || $patron && IsAvailableForItemLevelRequest( $item, $patron, undef );
699
        }
700
699
701
        # get collection code description, too
700
        # get collection code description, too
702
        my $ccode = $item->ccode;
701
        my $ccode = $item->ccode;
Lines 772-780 else { Link Here
772
    }
771
    }
773
}
772
}
774
773
775
$template->param( ReservableItems => $can_holds_be_placed );
776
777
$template->param(
774
$template->param(
775
    ReservableItems          => $can_holds_be_placed,
778
    itemloop_has_images      => $itemloop_has_images,
776
    itemloop_has_images      => $itemloop_has_images,
779
    otheritemloop_has_images => $otheritemloop_has_images,
777
    otheritemloop_has_images => $otheritemloop_has_images,
780
);
778
);
781
- 

Return to bug 34886