@@ -, +, @@ --- opac/opac-detail.pl | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) --- a/opac/opac-detail.pl +++ a/opac/opac-detail.pl @@ -70,9 +70,32 @@ 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 $dbh = C4::Context->dbh; +my $sth = $dbh->prepare("SELECT * FROM items WHERE biblionumber=?;"); +$sth->execute($biblionumber); + +my @itemsmatchingbiblionumber; +my $matchingitem = $sth->fetchrow_hashref; +while ($matchingitem) { + push @itemsmatchingbiblionumber,$matchingitem; + $matchingitem = $sth->fetchrow_hashref; +} + +my @items2hide; +if ($#itemsmatchingbiblionumber >= 0) { + @items2hide =GetHiddenItemnumbers(@itemsmatchingbiblionumber); +} + +# only hide if there are hidden items. $#items2hide=-1 for no items. +if ($#items2hide==$#itemsmatchingbiblionumber && $#items2hide>=0) { + # 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 @@ -628,7 +651,6 @@ if (scalar(@itemloop) >= 50 && !$viewallitems) { } ## get notes and subjects from MARC record -my $dbh = C4::Context->dbh; my $marcnotesarray = GetMarcNotes ($record,$marcflavour); my $marcisbnsarray = GetMarcISBN ($record,$marcflavour); my $marcauthorsarray = GetMarcAuthors ($record,$marcflavour); --