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 658-669 if ( C4::Context->preference('OPACAcquisitionDetails' ) ) { Link Here
658
    };
658
    };
659
}
659
}
660
660
661
# Count the number of items that allow holds
661
# Count the number of items that allow holds at the 'All libraries' rule level
662
my $holdable_items = $biblio->items->filter_by_for_hold->count;
662
my $holdable_items = $biblio->items->filter_by_for_hold->count;
663
# If we have a patron and there are no holdable items - we set to no
663
664
# If we have a patron and there are holdable items we set to no - and we need to check each item specifically
664
# If we have a patron we need to check their policies for holds in the loop below
665
# If we don't have a patron, then holdable items determines holdability
665
# If we don't have a patron, then holdable items determines holdability
666
my $can_holds_be_placed = $patron && $holdable_items ? 0 : $holdable_items;
666
my $can_holds_be_placed = $patron ? 0 : $holdable_items;
667
667
668
my ( $itemloop_has_images, $otheritemloop_has_images );
668
my ( $itemloop_has_images, $otheritemloop_has_images );
669
if ( not $viewallitems and $items->count > $max_items_to_display ) {
669
if ( not $viewallitems and $items->count > $max_items_to_display ) {
Lines 688-698 else { Link Here
688
        $item_info->{holding_library_info} = $opac_info_holding->content if $opac_info_holding;
688
        $item_info->{holding_library_info} = $opac_info_holding->content if $opac_info_holding;
689
        $item_info->{home_library_info} = $opac_info_home->content if $opac_info_home;
689
        $item_info->{home_library_info} = $opac_info_home->content if $opac_info_home;
690
690
691
        # We only need to check if we haven't determined holds can be place, and there are items that can
691
        # We only need to check if we haven't determined holds can be placed
692
        # be held, and we have a patron to determine holdability
692
        # and if we don't have patron, we have already decided
693
        if( !$can_holds_be_placed && $holdable_items && $patron ){
693
        $can_holds_be_placed =
694
            $can_holds_be_placed = IsAvailableForItemLevelRequest($item, $patron, undef);
694
            $can_holds_be_placed || $patron && IsAvailableForItemLevelRequest( $item, $patron, undef );
695
        }
696
695
697
        # get collection code description, too
696
        # get collection code description, too
698
        my $ccode = $item->ccode;
697
        my $ccode = $item->ccode;
Lines 768-776 else { Link Here
768
    }
767
    }
769
}
768
}
770
769
771
$template->param( ReservableItems => $can_holds_be_placed );
772
773
$template->param(
770
$template->param(
771
    ReservableItems          => $can_holds_be_placed,
774
    itemloop_has_images      => $itemloop_has_images,
772
    itemloop_has_images      => $itemloop_has_images,
775
    otheritemloop_has_images => $otheritemloop_has_images,
773
    otheritemloop_has_images => $otheritemloop_has_images,
776
);
774
);
777
- 

Return to bug 34886