X-Git-Url: http://koha-dev.rot13.org:8081/gitweb/?a=blobdiff_plain;f=opac%2Fopac-detail.pl;h=6173b728622b436d5605315bc1c366cf4b9e5973;hb=e917b5788ccc406263b49eda7bce6177260f73e6;hp=67c074cd70ab25a6c4bd8510d646e65199fd8099;hpb=7bc87ce75ec857292e433c0f6123b2ea02ef6d60;p=srvgit diff --git a/opac/opac-detail.pl b/opac/opac-detail.pl index 67c074cd70..6173b72862 100755 --- a/opac/opac-detail.pl +++ b/opac/opac-detail.pl @@ -89,10 +89,6 @@ if( $specific_item ) { } my @hiddenitems; my $patron = Koha::Patrons->find( $borrowernumber ); -our $borcat= q{}; -if ( C4::Context->preference('OpacHiddenItemsExceptions') ) { - $borcat = $patron ? $patron->categorycode : q{}; -} my $record = GetMarcBiblio({ biblionumber => $biblionumber, @@ -102,17 +98,20 @@ if ( ! $record ) { exit; } -if ( scalar @all_items >= 1 ) { - push @hiddenitems, - GetHiddenItemnumbers( { items => \@all_items, borcat => $borcat } ); - - if (scalar @hiddenitems == scalar @all_items ) { - print $query->redirect("/cgi-bin/koha/errors/404.pl"); # escape early +my $biblio = Koha::Biblios->find( $biblionumber ); +unless ( $patron and $patron->category->override_hidden_items ) { + # only skip this check if there's a logged in user + # and its category overrides OpacHiddenItems + if ( $biblio->hidden_in_opac({ rules => C4::Context->yaml_preference('OpacHiddenItems') }) ) { + print $query->redirect('/cgi-bin/koha/errors/404.pl'); # escape early exit; } + if ( scalar @all_items >= 1 ) { + push @hiddenitems, + GetHiddenItemnumbers( { items => \@all_items, borcat => $patron ? $patron->categorycode : undef } ); + } } -my $biblio = Koha::Biblios->find( $biblionumber ); my $framework = $biblio ? $biblio->frameworkcode : q{}; my $record_processor = Koha::RecordProcessor->new({ filters => 'ViewPolicy', @@ -280,7 +279,7 @@ if ($session->param('busc')) { my @newresults; my $search_context = { 'interface' => 'opac', - 'category' => $borcat + 'category' => ($patron) ? $patron->categorycode : q{} }; for (my $i=0;$i<@servers;$i++) { my $server = $servers[$i]; @@ -763,22 +762,21 @@ if ( not $viewallitems and @items > $max_items_to_display ) { } if ( C4::Context->preference("OPACLocalCoverImages") == 1 ) { - my $cover_image = $item->cover_image; - $itm->{imagenumber} = $cover_image ? $cover_image->imagenumber : undef; + $itm->{cover_images} = $item->cover_images; } my $itembranch = $itm->{$separatebranch}; if ($currentbranch and C4::Context->preference('OpacSeparateHoldings')) { if ($itembranch and $itembranch eq $currentbranch) { push @itemloop, $itm; - $itemloop_has_images++ if $itm->{imagenumber}; + $itemloop_has_images++ if $item->cover_images->count; } else { push @otheritemloop, $itm; - $otheritemloop_has_images++ if $itm->{imagenumber}; + $otheritemloop_has_images++ if $item->cover_images->count; } } else { push @itemloop, $itm; - $itemloop_has_images++ if $itm->{imagenumber}; + $itemloop_has_images++ if $item->cover_images->count; } } } @@ -817,7 +815,7 @@ if (!C4::Context->preference("OPACXSLTDetailsDisplay") ) { ); } -my $marcnotesarray = GetMarcNotes ($record,$marcflavour,1); +my $marcnotesarray = $biblio->get_marc_notes({ marcflavour => $marcflavour, opac => 1 }); if( C4::Context->preference('ArticleRequests') ) { my $patron = $borrowernumber ? Koha::Patrons->find($borrowernumber) : undef; @@ -901,7 +899,7 @@ my $coins = eval { $biblio->get_coins }; $template->param( ocoins => $coins ); my ( $loggedincommenter, $reviews ); -if ( C4::Context->preference('reviewson') ) { +if ( C4::Context->preference('OPACComments') ) { $reviews = Koha::Reviews->search( { biblionumber => $biblionumber,