From 8047c5eca8177bbf96b27a8df183da1d56cae329 Mon Sep 17 00:00:00 2001 From: Pedro Amorim Date: Mon, 25 Sep 2023 12:19:25 +0000 Subject: [PATCH] Bug 34886: Rename can_item_be_reserved variable This variable is named like a function that returns a boolean, but is actually just a flag. Signed-off-by: Martin Renvoize --- opac/opac-ISBDdetail.pl | 6 +++--- opac/opac-MARCdetail.pl | 6 +++--- opac/opac-detail.pl | 8 ++++---- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/opac/opac-ISBDdetail.pl b/opac/opac-ISBDdetail.pl index 86685f9239..f984e4bee8 100755 --- a/opac/opac-ISBDdetail.pl +++ b/opac/opac-ISBDdetail.pl @@ -168,7 +168,7 @@ $template->param( subscriptionsnumber => $subscriptionsnumber, ); -my $can_item_be_reserved = 0; +my $has_reservable_items = 0; my $res = GetISBDView({ 'record' => $record, 'template' => 'opac', @@ -178,10 +178,10 @@ my $res = GetISBDView({ my $items = $biblio->items; while ( my $item = $items->next ) { - $can_item_be_reserved = $can_item_be_reserved || $patron && IsAvailableForItemLevelRequest( $item, $patron, undef ); + $has_reservable_items = $has_reservable_items || IsAvailableForItemLevelRequest( $item, $patron, undef ); } -if( $can_item_be_reserved || CountItemsIssued($biblionumber) || $biblio->has_items_waiting_or_intransit ) { +if( $has_reservable_items || CountItemsIssued($biblionumber) || $biblio->has_items_waiting_or_intransit ) { $template->param( ReservableItems => 1 ); } diff --git a/opac/opac-MARCdetail.pl b/opac/opac-MARCdetail.pl index 9b85bbbe1e..62e2823ff1 100755 --- a/opac/opac-MARCdetail.pl +++ b/opac/opac-MARCdetail.pl @@ -136,14 +136,14 @@ $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; +my $has_reservable_items = 0; $items->reset; while ( my $item = $items->next ) { - $can_item_be_reserved = $can_item_be_reserved || $patron && IsAvailableForItemLevelRequest( $item, $patron, undef ); + $has_reservable_items = $has_reservable_items || IsAvailableForItemLevelRequest( $item, $patron, undef ); } -if( $can_item_be_reserved || CountItemsIssued($biblionumber) || $biblio->has_items_waiting_or_intransit ) { +if( $has_reservable_items || CountItemsIssued($biblionumber) || $biblio->has_items_waiting_or_intransit ) { $template->param( ReservableItems => 1 ); } diff --git a/opac/opac-detail.pl b/opac/opac-detail.pl index 2483e55772..59eeedcfe1 100755 --- a/opac/opac-detail.pl +++ b/opac/opac-detail.pl @@ -658,7 +658,7 @@ if ( C4::Context->preference('OPACAcquisitionDetails' ) ) { }; } -my $can_item_be_reserved = 0; +my $has_reservable_items = 0; my ( $itemloop_has_images, $otheritemloop_has_images ); if ( not $viewallitems and $items->count > $max_items_to_display ) { $template->param( @@ -683,9 +683,9 @@ else { $item_info->{home_library_info} = $opac_info_home->content if $opac_info_home; if ( $patron ) { - $can_item_be_reserved = IsAvailableForItemLevelRequest($item, $patron, undef); + $has_reservable_items = IsAvailableForItemLevelRequest($item, $patron, undef); } else { - $can_item_be_reserved = + $has_reservable_items = Koha::CirculationRules->get_onshelfholds_policy( { item => $item, patron => undef } ); } @@ -763,7 +763,7 @@ else { } } -if( $can_item_be_reserved || CountItemsIssued($biblionumber) || $biblio->has_items_waiting_or_intransit ) { +if( $has_reservable_items || CountItemsIssued($biblionumber) || $biblio->has_items_waiting_or_intransit ) { $template->param( ReservableItems => 1 ); } -- 2.30.2