Revert "Bug 6554 - make Koha internally utf-8 clean"
[koha.git] / catalogue / detail.pl
index 6b313b2..a5b32c6 100755 (executable)
@@ -138,9 +138,6 @@ if (@hostitems){
 
 my $dat = &GetBiblioData($biblionumber);
 
-# get count of holds
-my ( $holdcount, $holds ) = GetReservesFromBiblionumber($biblionumber,1);
-
 #coping with subscriptions
 my $subscriptionsnumber = CountSubscriptionFromBiblionumber($biblionumber);
 my @subscriptions       = GetSubscriptions( $dat->{title}, $dat->{issn}, undef, $biblionumber );
@@ -284,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,
@@ -301,7 +306,6 @@ $template->param(
        volinfo                         => $itemfields{enumchron},
     itemdata_itemnotes  => $itemfields{itemnotes},
        z3950_search_params     => C4::Search::z3950_search_args($dat),
-    holdcount           => $holdcount,
         hostrecords         => $hostrecords,
        analytics_flag  => $analytics_flag,
        C4::Search::enabled_staff_search_views,
@@ -399,4 +403,7 @@ if (C4::Context->preference('TagsEnabled') and $tag_quantity = C4::Context->pref
                                 'sort'=>'-weight', limit=>$tag_quantity}));
 }
 
+my ( $holdcount, $holds ) = C4::Reserves::GetReservesFromBiblionumber($biblionumber,1);
+$template->param( holdcount => $holdcount, holds => $holds );
+
 output_html_with_http_headers $query, $cookie, $template->output;