@@ -, +, @@ OpacHiddenItems --- C4/Search.pm | 2 +- installer/data/mysql/sysprefs.sql | 1 + .../prog/en/modules/admin/preferences/opac.pref | 7 +++++++ opac/opac-ISBDdetail.pl | 2 +- opac/opac-MARCdetail.pl | 2 +- opac/opac-basket.pl | 2 +- opac/opac-detail.pl | 2 +- opac/opac-tags.pl | 2 +- 8 files changed, 14 insertions(+), 6 deletions(-) --- a/C4/Search.pm +++ a/C4/Search.pm @@ -2065,7 +2065,7 @@ sub searchResults { } # notforloan, item level and biblioitem level # if all items are hidden, do not show the record - if ($items_count > 0 && $hideatopac_count == $items_count) { + if ( C4::Context->preference('OpacHiddenItemsHidesRecord') && $items_count > 0 && $hideatopac_count == $items_count) { next; } --- a/installer/data/mysql/sysprefs.sql +++ a/installer/data/mysql/sysprefs.sql @@ -395,6 +395,7 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` ('OPACFRBRizeEditions','0','','If ON, the OPAC will query one or more ISBN web services for associated ISBNs and display an Editions tab on the details pages','YesNo'), ('OpacHiddenItems','','','This syspref allows to define custom rules for hiding specific items at the OPAC. See http://wiki.koha-community.org/wiki/OpacHiddenItems for more information.','Textarea'), ('OpacHiddenItemsExceptions','',NULL,'List of borrower categories, separated by |, that can see items otherwise hidden by OpacHiddenItems','Textarea'), +('OpacHiddenItemsHidesRecord','1','','Hide biblio record when all its items are hidden because of OpacHiddenItems','YesNo'), ('OpacHighlightedWords','1','','If Set, then queried words are higlighted in OPAC','YesNo'), ('OPACHoldingsDefaultSortField','first_column','first_column|homebranch|holdingbranch','Default sort field for the holdings table at the OPAC','choice'), ('OPACHoldsIfAvailableAtPickup','1','','Allow to pickup up holds at libraries where the item is available','YesNo'), --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref @@ -638,6 +638,13 @@ OPAC: - - "List of patron categories, separated by |, that can see items otherwise hidden by OpacHiddenItems:" - pref: OpacHiddenItemsExceptions + - + - pref: OpacHiddenItemsHidesRecord + default: 1 + choices: + no: "Don't hide" + yes: Hide + - "biblio record when all its items are hidden by OpacHiddenItems." - - pref: OpacAllowPublicListCreation default: 1 --- a/opac/opac-ISBDdetail.pl +++ a/opac/opac-ISBDdetail.pl @@ -88,7 +88,7 @@ eval { 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 => $opachiddenitems_rules }) ) { + if ( C4::Context->preference('OpacHiddenItemsHidesRecord') && $biblio->hidden_in_opac({ rules => $opachiddenitems_rules }) ) { print $query->redirect('/cgi-bin/koha/errors/404.pl'); # escape early exit; } --- a/opac/opac-MARCdetail.pl +++ a/opac/opac-MARCdetail.pl @@ -108,7 +108,7 @@ my $framework = $biblio ? $biblio->frameworkcode : q{}; my $tagslib = &GetMarcStructure( 0, $framework ); my ($tag_itemnumber,$subtag_itemnumber) = &GetMarcFromKohaField( 'items.itemnumber' ); my @nonhiddenitems = $record->field($tag_itemnumber); -if (scalar @all_items >= 1 && scalar @nonhiddenitems == 0) { +if ( C4::Context->preference('OpacHiddenItemsHidesRecord') && scalar @all_items >= 1 && scalar @nonhiddenitems == 0 ) { print $query->redirect("/cgi-bin/koha/errors/404.pl"); exit; } --- a/opac/opac-basket.pl +++ a/opac/opac-basket.pl @@ -94,7 +94,7 @@ foreach my $biblionumber ( @bibs ) { my @hidden_items = GetHiddenItemnumbers({ items => \@all_items, borcat => $borcat }); # If every item is hidden, then the biblio should be hidden too. - next if (scalar @all_items >= 1 && scalar @hidden_items == scalar @all_items); + next if ( C4::Context->preference('OpacHiddenItemsHidesRecord') && scalar @all_items >= 1 && scalar @hidden_items == scalar @all_items); # copy the visible ones into the items array. my @items; --- a/opac/opac-detail.pl +++ a/opac/opac-detail.pl @@ -107,7 +107,7 @@ if ( scalar @all_items >= 1 ) { push @hiddenitems, GetHiddenItemnumbers( { items => \@all_items, borcat => $borcat } ); - if (scalar @hiddenitems == scalar @all_items ) { + if ( C4::Context->preference('OpacHiddenItemsHidesRecord') && scalar @hiddenitems == scalar @all_items ) { print $query->redirect("/cgi-bin/koha/errors/404.pl"); # escape early exit; } --- a/opac/opac-tags.pl +++ a/opac/opac-tags.pl @@ -270,7 +270,7 @@ if ($loggedinuser) { borcat => $borcat }); $hidden_items = \@hidden_itemnumbers; } - next if ( $should_hide && scalar @all_items == scalar @hidden_itemnumbers ); + next if ( C4::Context->preference('OpacHiddenItemsHidesRecord') && $should_hide && scalar @all_items == scalar @hidden_itemnumbers ); $tag->{title} = $biblio->title; $tag->{subtitle} = $biblio->subtitle; $tag->{medium} = $biblio->medium; --