Bug 34886: Adjust other opac detail scripts

Same chanegs as before, but for MARC and ISBD details pages

Signed-off-by: David Nind <david@davidnind.com>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit d134dbf4f1)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
This commit is contained in:
Nick Clemens 2023-09-28 13:14:54 +00:00 committed by Fridolin Somers
parent 6c1d615394
commit 800b012deb
4 changed files with 38 additions and 37 deletions

View file

@ -1,7 +1,6 @@
[% USE raw %]
[% USE Biblio %]
<ul id="action">
[% UNLESS ( norequests ) %]
[% IF Koha.Preference( 'opacuserlogin' ) == 1 %]
[% IF Koha.Preference( 'OPACHoldRequests' ) == 1 %]
[% IF ( ReservableItems ) %]
@ -9,7 +8,6 @@
[% END %]
[% END %]
[% END %]
[% END %]
[% IF Koha.Preference('UseRecalls') %]
<li><a class="recall btn btn-link btn-lg" href="/cgi-bin/koha/opac-recall.pl?biblionumber=[% biblio.biblionumber | html %]"><i class="fa fa-solid fa-fw fa-book-bookmark" aria-hidden="true"></i>

View file

@ -168,27 +168,27 @@ $template->param(
subscriptionsnumber => $subscriptionsnumber,
);
my $can_item_be_reserved = 0;
my $res = GetISBDView({
'record' => $record,
'template' => 'opac',
'framework' => $biblio->frameworkcode
});
# Count the number of items that allow holds at the 'All libraries' rule level
my $holdable_items = $biblio->items->filter_by_for_hold->count;
# If we have a patron we need to check their policies for holds in the loop below
# If we don't have a patron, then holdable items determines holdability
my $can_holds_be_placed = $patron ? 0 : $holdable_items;
if ($patron) {
my $items = $biblio->items;
while ( my $item = $items->next ) {
$can_item_be_reserved = $can_item_be_reserved || $patron && IsAvailableForItemLevelRequest( $item, $patron, undef );
$can_holds_be_placed = $can_holds_be_placed || IsAvailableForItemLevelRequest( $item, $patron, undef );
}
if( $can_item_be_reserved || CountItemsIssued($biblionumber) || $biblio->has_items_waiting_or_intransit ) {
$template->param( ReservableItems => 1 );
}
my $norequests = ! $items->filter_by_for_hold->count;
$template->param(
norequests => $norequests,
ReservableItems => $can_holds_be_placed,
ISBD => $res,
biblio => $biblio,
);

View file

@ -136,16 +136,21 @@ $template->param(
) if $tagslib->{$bt_tag}->{$bt_subtag}->{hidden} <= 0 && # <=0 OPAC visible.
$tagslib->{$bt_tag}->{$bt_subtag}->{hidden} > -8; # except -8;
my $can_item_be_reserved = 0;
# Count the number of items that allow holds at the 'All libraries' rule level
my $holdable_items = $biblio->items->filter_by_for_hold->count;
# If we have a patron we need to check their policies for holds in the loop below
# If we don't have a patron, then holdable items determines holdability
my $can_holds_be_placed = $patron ? 0 : $holdable_items;
if ($patron) {
$items->reset;
while ( my $item = $items->next ) {
$can_item_be_reserved = $can_item_be_reserved || $patron && IsAvailableForItemLevelRequest( $item, $patron, undef );
$can_holds_be_placed = $can_holds_be_placed || IsAvailableForItemLevelRequest( $item, $patron, undef );
}
}
if( $can_item_be_reserved || CountItemsIssued($biblionumber) || $biblio->has_items_waiting_or_intransit ) {
$template->param( ReservableItems => 1 );
}
$template->param( ReservableItems => $can_holds_be_placed );
# fill arrays
my @loop_data = ();

View file

@ -662,12 +662,12 @@ if ( C4::Context->preference('OPACAcquisitionDetails' ) ) {
};
}
# Count the number of items that allow holds
# Count the number of items that allow holds at the 'All libraries' rule level
my $holdable_items = $biblio->items->filter_by_for_hold->count;
# If we have a patron and there are no holdable items - we set to no
# If we have a patron and there are holdable items we set to no - and we need to check each item specifically
# If we have a patron we need to check their policies for holds in the loop below
# If we don't have a patron, then holdable items determines holdability
my $can_holds_be_placed = $patron && $holdable_items ? 0 : $holdable_items;
my $can_holds_be_placed = $patron ? 0 : $holdable_items;
my ( $itemloop_has_images, $otheritemloop_has_images );
if ( not $viewallitems and $items->count > $max_items_to_display ) {
@ -692,11 +692,10 @@ else {
$item_info->{holding_library_info} = $opac_info_holding->content if $opac_info_holding;
$item_info->{home_library_info} = $opac_info_home->content if $opac_info_home;
# We only need to check if we haven't determined holds can be place, and there are items that can
# be held, and we have a patron to determine holdability
if( !$can_holds_be_placed && $holdable_items && $patron ){
$can_holds_be_placed = IsAvailableForItemLevelRequest($item, $patron, undef);
}
# We only need to check if we haven't determined holds can be placed
# and if we don't have patron, we have already decided
$can_holds_be_placed =
$can_holds_be_placed || $patron && IsAvailableForItemLevelRequest( $item, $patron, undef );
# get collection code description, too
my $ccode = $item->ccode;
@ -772,9 +771,8 @@ else {
}
}
$template->param( ReservableItems => $can_holds_be_placed );
$template->param(
ReservableItems => $can_holds_be_placed,
itemloop_has_images => $itemloop_has_images,
otheritemloop_has_images => $otheritemloop_has_images,
);