From 90c323f7135d1089e4b2fa22a0c270fba3870b39 Mon Sep 17 00:00:00 2001 From: Julian Maurice Date: Thu, 10 Jan 2013 17:01:37 +0100 Subject: [PATCH] Bug 9875: Hide empty items tab The two holdings tabs displayed whether or not there is anything to go in them. Signed-off-by: Corinne Bulac Signed-off-by: Katrin Fischer If one item list is empty, no empty tab is shown. All tests and QA script pass. Signed-off-by: Jared Camins-Esakov --- catalogue/detail.pl | 8 ++++++++ opac/opac-detail.pl | 8 ++++++++ 2 files changed, 16 insertions(+) diff --git a/catalogue/detail.pl b/catalogue/detail.pl index ec6f6eb8d3..a5b32c69a6 100755 --- a/catalogue/detail.pl +++ b/catalogue/detail.pl @@ -281,6 +281,14 @@ foreach my $item (@items) { } } +# Display only one tab if one items list is empty +if (scalar(@itemloop) == 0 || scalar(@otheritemloop) == 0) { + $template->param(SeparateHoldings => 0); + if (scalar(@itemloop) == 0) { + @itemloop = @otheritemloop; + } +} + $template->param( norequests => $norequests ); $template->param( MARCNOTES => $marcnotesarray, diff --git a/opac/opac-detail.pl b/opac/opac-detail.pl index 883ea7c8bb..4371f6524b 100755 --- a/opac/opac-detail.pl +++ b/opac/opac-detail.pl @@ -576,6 +576,14 @@ for my $itm (@items) { } } +# Display only one tab if one items list is empty +if (scalar(@itemloop) == 0 || scalar(@otheritemloop) == 0) { + $template->param(SeparateHoldings => 0); + if (scalar(@itemloop) == 0) { + @itemloop = @otheritemloop; + } +} + # If there is a lot of items, and the user has not decided # to view them all yet, we first warn him # TODO: The limit of 50 could be a syspref -- 2.39.5