View | Details | Raw Unified | Return to bug 18989
Collapse All | Expand All

(-)a/C4/Search.pm (-1 / +1 lines)
Lines 1992-1998 sub searchResults { Link Here
1992
        }    # notforloan, item level and biblioitem level
1992
        }    # notforloan, item level and biblioitem level
1993
1993
1994
        # if all items are hidden, do not show the record
1994
        # if all items are hidden, do not show the record
1995
        if ($items_count > 0 && $hideatopac_count == $items_count) {
1995
        if ( C4::Context->preference('OpacHiddenItemsHidesRecord') && $items_count > 0 && $hideatopac_count == $items_count) {
1996
            next;
1996
            next;
1997
        }
1997
        }
1998
1998
(-)a/installer/data/mysql/mandatory/sysprefs.sql (+1 lines)
Lines 410-415 INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` Link Here
410
('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'),
410
('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'),
411
('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'),
411
('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'),
412
('OpacHiddenItemsExceptions','',NULL,'List of borrower categories, separated by |, that can see items otherwise hidden by OpacHiddenItems','Textarea'),
412
('OpacHiddenItemsExceptions','',NULL,'List of borrower categories, separated by |, that can see items otherwise hidden by OpacHiddenItems','Textarea'),
413
('OpacHiddenItemsHidesRecord','1','','Hide biblio record when all its items are hidden because of OpacHiddenItems','YesNo'),
413
('OpacHighlightedWords','1','','If Set, then queried words are higlighted in OPAC','YesNo'),
414
('OpacHighlightedWords','1','','If Set, then queried words are higlighted in OPAC','YesNo'),
414
('OPACHoldingsDefaultSortField','first_column','first_column|homebranch|holdingbranch','Default sort field for the holdings table at the OPAC','choice'),
415
('OPACHoldingsDefaultSortField','first_column','first_column|homebranch|holdingbranch','Default sort field for the holdings table at the OPAC','choice'),
415
('OPACHoldsHistory','0','','If ON, enables display of Patron Holds History in OPAC','YesNo'),
416
('OPACHoldsHistory','0','','If ON, enables display of Patron Holds History in OPAC','YesNo'),
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref (+7 lines)
Lines 656-661 OPAC: Link Here
656
            - 'List of patron categories, separated by |, that can see items otherwise hidden by <a href="/cgi-bin/koha/admin/preferences.pl?op=search&searchfield=OpacHiddenItems">OpacHiddenItems</a>:'
656
            - 'List of patron categories, separated by |, that can see items otherwise hidden by <a href="/cgi-bin/koha/admin/preferences.pl?op=search&searchfield=OpacHiddenItems">OpacHiddenItems</a>:'
657
            - pref: OpacHiddenItemsExceptions
657
            - pref: OpacHiddenItemsExceptions
658
        -
658
        -
659
            - pref: OpacHiddenItemsHidesRecord
660
              default: 1
661
              choices:
662
                  no: "Don't hide"
663
                  yes: Hide
664
            - "biblio record when all its items are hidden by <code>OpacHiddenItems</code>."
665
        -
659
            - pref: OpacAllowPublicListCreation
666
            - pref: OpacAllowPublicListCreation
660
              default: 1
667
              default: 1
661
              choices:
668
              choices:
(-)a/opac/opac-ISBDdetail.pl (-1 / +1 lines)
Lines 90-96 eval { Link Here
90
unless ( $patron and $patron->category->override_hidden_items ) {
90
unless ( $patron and $patron->category->override_hidden_items ) {
91
    # only skip this check if there's a logged in user
91
    # only skip this check if there's a logged in user
92
    # and its category overrides OpacHiddenItems
92
    # and its category overrides OpacHiddenItems
93
    if ( $biblio->hidden_in_opac({ rules => $opachiddenitems_rules }) ) {
93
    if ( C4::Context->preference('OpacHiddenItemsHidesRecord') && $biblio->hidden_in_opac({ rules => $opachiddenitems_rules }) ) {
94
        print $query->redirect('/cgi-bin/koha/errors/404.pl'); # escape early
94
        print $query->redirect('/cgi-bin/koha/errors/404.pl'); # escape early
95
        exit;
95
        exit;
96
    }
96
    }
(-)a/opac/opac-MARCdetail.pl (-1 / +1 lines)
Lines 108-114 my $framework = $biblio ? $biblio->frameworkcode : q{}; Link Here
108
my $tagslib = &GetMarcStructure( 0, $framework );
108
my $tagslib = &GetMarcStructure( 0, $framework );
109
my ($tag_itemnumber,$subtag_itemnumber) = &GetMarcFromKohaField( 'items.itemnumber' );
109
my ($tag_itemnumber,$subtag_itemnumber) = &GetMarcFromKohaField( 'items.itemnumber' );
110
my @nonhiddenitems = $record->field($tag_itemnumber);
110
my @nonhiddenitems = $record->field($tag_itemnumber);
111
if (scalar @all_items >= 1 && scalar @nonhiddenitems == 0) {
111
if ( C4::Context->preference('OpacHiddenItemsHidesRecord') && scalar @all_items >= 1 && scalar @nonhiddenitems == 0 ) {
112
    print $query->redirect("/cgi-bin/koha/errors/404.pl");
112
    print $query->redirect("/cgi-bin/koha/errors/404.pl");
113
    exit;
113
    exit;
114
}
114
}
(-)a/opac/opac-basket.pl (-1 / +1 lines)
Lines 96-102 foreach my $biblionumber ( @bibs ) { Link Here
96
    my @hidden_items     = GetHiddenItemnumbers({ items => \@all_items, borcat => $borcat });
96
    my @hidden_items     = GetHiddenItemnumbers({ items => \@all_items, borcat => $borcat });
97
97
98
    # If every item is hidden, then the biblio should be hidden too.
98
    # If every item is hidden, then the biblio should be hidden too.
99
    next if (scalar @all_items >= 1 && scalar @hidden_items == scalar @all_items);
99
    next if ( C4::Context->preference('OpacHiddenItemsHidesRecord') && scalar @all_items >= 1 && scalar @hidden_items == scalar @all_items);
100
100
101
    # copy the visible ones into the items array.
101
    # copy the visible ones into the items array.
102
    my @items;
102
    my @items;
(-)a/opac/opac-detail.pl (-1 / +1 lines)
Lines 106-112 if ( scalar @all_items >= 1 ) { Link Here
106
    push @hiddenitems,
106
    push @hiddenitems,
107
      GetHiddenItemnumbers( { items => \@all_items, borcat => $borcat } );
107
      GetHiddenItemnumbers( { items => \@all_items, borcat => $borcat } );
108
108
109
    if (scalar @hiddenitems == scalar @all_items ) {
109
    if ( C4::Context->preference('OpacHiddenItemsHidesRecord') && scalar @hiddenitems == scalar @all_items ) {
110
        print $query->redirect("/cgi-bin/koha/errors/404.pl"); # escape early
110
        print $query->redirect("/cgi-bin/koha/errors/404.pl"); # escape early
111
        exit;
111
        exit;
112
    }
112
    }
(-)a/opac/opac-tags.pl (-2 / +1 lines)
Lines 270-276 if ($loggedinuser) { Link Here
270
                borcat => $borcat });
270
                borcat => $borcat });
271
            $hidden_items = \@hidden_itemnumbers;
271
            $hidden_items = \@hidden_itemnumbers;
272
        }
272
        }
273
        next if ( $should_hide && scalar @all_items == scalar @hidden_itemnumbers );
273
        next if ( C4::Context->preference('OpacHiddenItemsHidesRecord') && $should_hide && scalar @all_items == scalar @hidden_itemnumbers );
274
        $tag->{title} = $biblio->title;
274
        $tag->{title} = $biblio->title;
275
        $tag->{subtitle} = $biblio->subtitle;
275
        $tag->{subtitle} = $biblio->subtitle;
276
        $tag->{medium} = $biblio->medium;
276
        $tag->{medium} = $biblio->medium;
277
- 

Return to bug 18989