}
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,
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',
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];
}
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;
}
}
}
);
}
-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;
$template->param( ocoins => $coins );
my ( $loggedincommenter, $reviews );
-if ( C4::Context->preference('reviewson') ) {
+if ( C4::Context->preference('OPACComments') ) {
$reviews = Koha::Reviews->search(
{
biblionumber => $biblionumber,