From: Mark Tompsett <[email protected]>

If there are items for a given biblio number, and they are all
hidden, then biblio needs to be hidden. If the biblio needs to
be hidden, this is done by setting the biblionumber to 0, which
triggers the same output as if the biblionumber does not exist.

Signed-off-by: Srdjan <[email protected]>
---
 opac/opac-detail.pl | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/opac/opac-detail.pl b/opac/opac-detail.pl
index 9d0851f..612831a 100755
--- a/opac/opac-detail.pl
+++ b/opac/opac-detail.pl
@@ -70,9 +70,20 @@ my ( $template, $borrowernumber, $cookie ) = 
get_template_and_user(
     }
 );
 
-my $biblionumber = $query->param('biblionumber') || $query->param('bib');
+my $biblionumber = $query->param('biblionumber') || $query->param('bib') || 0;
 $biblionumber = int($biblionumber);
 
+my @itemsmatchingbiblionumber = GetItemsInfo($biblionumber);
+if (scalar @itemsmatchingbiblionumber >= 1) {
+    my @items2hide = GetHiddenItemnumbers(@itemsmatchingbiblionumber);
+
+    if (scalar @items2hide == scalar @itemsmatchingbiblionumber ) {
+        # biblionumber=0 effectively hides the biblio record
+        # since there is no such biblionumber.
+        $biblionumber = 0;
+    }
+}
+
 my $record       = GetMarcBiblio($biblionumber);
 if ( ! $record ) {
     print $query->redirect("/cgi-bin/koha/errors/404.pl"); # escape early
-- 
1.8.1.2
_______________________________________________
Koha-patches mailing list
[email protected]
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-patches
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/

Reply via email to