From 5756e5a29098a0cc193e78027d2a737d2cb9dd2e 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 (cherry picked from commit b542c9971eebc62af5435cdf1a85b89ddf6fcfbd) Signed-off-by: Fridolin Somers --- opac/opac-MARCdetail.pl | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/opac/opac-MARCdetail.pl b/opac/opac-MARCdetail.pl index 39cb10eecf..c80a66d4ac 100755 --- a/opac/opac-MARCdetail.pl +++ b/opac/opac-MARCdetail.pl @@ -136,9 +136,19 @@ $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; + for my $itm (@all_items) { my $item = Koha::Items->find( $itm->{itemnumber} ); + $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 } ); last if $allow_onshelf_holds; } @@ -379,6 +389,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