@@ -, +, @@ --- opac/opac-detail.pl | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) --- a/opac/opac-detail.pl +++ a/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); +my @hiddenitems; +if (scalar @itemsmatchingbiblionumber >= 1) { + push @hiddenitems, GetHiddenItemnumbers(@itemsmatchingbiblionumber); + + if (scalar @hiddenitems == scalar @itemsmatchingbiblionumber ) { + print $query->redirect("/cgi-bin/koha/errors/404.pl"); # escape early + exit; + } +} + my $record = GetMarcBiblio($biblionumber); if ( ! $record ) { print $query->redirect("/cgi-bin/koha/errors/404.pl"); # escape early @@ -397,8 +408,10 @@ $template->param( 'ItemsIssued' => CountItemsIssued( $biblionumber ) ); $template->param('OPACShowCheckoutName' => C4::Context->preference("OPACShowCheckoutName") ); $template->param('OPACShowBarcode' => C4::Context->preference("OPACShowBarcode") ); +# FIXME -- Perhaps this 2002 comment no longer applies? +# Bug 10584 just changed the line following it. # change back when ive fixed request.pl -my @all_items = GetItemsInfo( $biblionumber ); +my @all_items = @itemsmatchingbiblionumber; # adding items linked via host biblios @@ -421,9 +434,6 @@ foreach my $hostfield ( $record->field($analyticfield)) { my @items; -# Getting items to be hidden -my @hiddenitems = GetHiddenItemnumbers(@all_items); - # Are there items to hide? my $hideitems; $hideitems = 1 if C4::Context->preference('hidelostitems') or scalar(@hiddenitems) > 0; --