From cbf59b1fa602eb503a4570a13f79f128bcce9a48 Mon Sep 17 00:00:00 2001 From: Marcel de Rooy Date: Fri, 15 Dec 2017 10:49:44 +0100 Subject: [PATCH] Bug 4319: (QA follow-up) Use ReservableItems in all scripts [1] Call CountItemsIssued or hasItemswaitingOrInTransit when needed only. [2] Add this logic to ISBD and MARC detail too, since they also use this include. Signed-off-by: Marcel de Rooy Confirming that Place hold now comes up if you have a waiting item and circulation rule == If any unavailable. Signed-off-by: Jonathan Druart --- opac/opac-ISBDdetail.pl | 7 ++++--- opac/opac-MARCdetail.pl | 5 +++-- opac/opac-detail.pl | 6 +++--- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/opac/opac-ISBDdetail.pl b/opac/opac-ISBDdetail.pl index 7af74104f3..d9447cc72e 100755 --- a/opac/opac-ISBDdetail.pl +++ b/opac/opac-ISBDdetail.pl @@ -79,8 +79,6 @@ if(my $cart_list = $query->cookie("bib_list")){ } } -$template->param( 'ItemsIssued' => CountItemsIssued( $biblionumber ) ); - my $marcflavour = C4::Context->preference("marcflavour"); my @items = GetItemsInfo($biblionumber); @@ -183,9 +181,12 @@ for my $itm (@items) { unless $allow_onshelf_holds; } +if( $allow_onshelf_holds || CountItemsIssued($biblionumber) || $biblio->hasItemswaitingOrInTransit ) { + $template->param( ReservableItems => 1 ); +} + $template->param( RequestOnOpac => C4::Context->preference("RequestOnOpac"), - AllowOnShelfHolds => $allow_onshelf_holds, norequests => $norequests, ISBD => $res, biblio => $biblio, diff --git a/opac/opac-MARCdetail.pl b/opac/opac-MARCdetail.pl index 334e383e25..90b2974914 100755 --- a/opac/opac-MARCdetail.pl +++ b/opac/opac-MARCdetail.pl @@ -136,8 +136,9 @@ for my $itm (@all_items) { last if $allow_onshelf_holds; } -$template->param( 'AllowOnShelfHolds' => $allow_onshelf_holds ); -$template->param( 'ItemsIssued' => CountItemsIssued( $biblionumber ) ); +if( $allow_onshelf_holds || CountItemsIssued($biblionumber) || $biblio->hasItemswaitingOrInTransit ) { + $template->param( ReservableItems => 1 ); +} # adding the $RequestOnOpac param my $RequestOnOpac; diff --git a/opac/opac-detail.pl b/opac/opac-detail.pl index d6754bf4f9..9a1177e32e 100755 --- a/opac/opac-detail.pl +++ b/opac/opac-detail.pl @@ -719,9 +719,9 @@ if ( not $viewallitems and @items > $max_items_to_display ) { } } -my $itemsWaitingOrInTransit = Koha::Biblios->find($biblionumber)->hasItemswaitingOrInTransit || 0; -my $itemsIssued = CountItemsIssued( $biblionumber ); -$template->param( 'ReservableItems' => $itemsWaitingOrInTransit || $itemsIssued || $allow_onshelf_holds ); +if( $allow_onshelf_holds || CountItemsIssued($biblionumber) || $biblio->hasItemswaitingOrInTransit ) { + $template->param( ReservableItems => 1 ); +} # Display only one tab if one items list is empty if (scalar(@itemloop) == 0 || scalar(@otheritemloop) == 0) { -- 2.39.5