From b542c9971eebc62af5435cdf1a85b89ddf6fcfbd Mon Sep 17 00:00:00 2001 From: Owen Leonard Date: Mon, 24 May 2021 15:55:43 +0000 Subject: [PATCH] Bug 28422: OPAC MARC detail view doesn't correctly evaluate holdability This patch modifies the MARC detail view in the OPAC so that it evaluates whether a title can be placed on hold in the same way it is done on the "normal" detail page and the ISBD detail page. This allows for consistency in the display of the "Place hold" link. To test, apply the patch and log into the OPAC. - Perform a search which will return results, at least one of which can be placed on hold. - View the detail page, the MARC detail page, and the ISBD detail page. In each case the "Place hold" link should appear in the sidebar. - View the same pages for a record which cannot be placed on hold to confirm that the link doesn't appear. For instance: - All items are not for loan. - All items are lost. - There are no items attached. Signed-off-by: David Nind Signed-off-by: Katrin Fischer Signed-off-by: Jonathan Druart Signed-off-by: Kyle M Hall --- opac/opac-MARCdetail.pl | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/opac/opac-MARCdetail.pl b/opac/opac-MARCdetail.pl index 4362270959..14b51d2ba1 100755 --- a/opac/opac-MARCdetail.pl +++ b/opac/opac-MARCdetail.pl @@ -138,11 +138,21 @@ $template->param( ) if $tagslib->{$bt_tag}->{$bt_subtag}->{hidden} <= 0 && # <=0 OPAC visible. $tagslib->{$bt_tag}->{$bt_subtag}->{hidden} > -8; # except -8; +my $norequests = 1; my $allow_onshelf_holds; my $items = $biblio->items; + while ( my $item = $items->next ) { - $allow_onshelf_holds = Koha::CirculationRules->get_onshelfholds_policy( { item => $item, patron => $patron } ); - last if $allow_onshelf_holds; + $norequests = 0 + if $norequests + && !$item->withdrawn + && !$item->itemlost + && ($item->notforloan < 0 || not $item->notforloan ) + && !Koha::ItemTypes->find($item->effective_itemtype)->notforloan + && $item->itemnumber; + + $allow_onshelf_holds = Koha::CirculationRules->get_onshelfholds_policy( { item => $item, patron => $patron } ) + unless $allow_onshelf_holds; } if( $allow_onshelf_holds || CountItemsIssued($biblionumber) || $biblio->has_items_waiting_or_intransit ) { @@ -381,6 +391,7 @@ $template->param( item_header_loop => \@item_header_loop, item_subfield_codes => \@item_subfield_codes, biblio => $biblio, + norequests => $norequests, ); output_html_with_http_headers $query, $cookie, $template->output; -- 2.39.5