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

(-)a/C4/Search.pm (-1 / +1 lines)
Lines 2065-2071 sub searchResults { Link Here
2065
        }    # notforloan, item level and biblioitem level
2065
        }    # notforloan, item level and biblioitem level
2066
2066
2067
        # if all items are hidden, do not show the record
2067
        # if all items are hidden, do not show the record
2068
        if ($items_count > 0 && $hideatopac_count == $items_count) {
2068
        if ( C4::Context->preference('OpacHiddenItemsHidesRecord') && $items_count > 0 && $hideatopac_count == $items_count) {
2069
            next;
2069
            next;
2070
        }
2070
        }
2071
2071
(-)a/installer/data/mysql/sysprefs.sql (+1 lines)
Lines 395-400 INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` Link Here
395
('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'),
395
('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'),
396
('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'),
396
('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'),
397
('OpacHiddenItemsExceptions','',NULL,'List of borrower categories, separated by |, that can see items otherwise hidden by OpacHiddenItems','Textarea'),
397
('OpacHiddenItemsExceptions','',NULL,'List of borrower categories, separated by |, that can see items otherwise hidden by OpacHiddenItems','Textarea'),
398
('OpacHiddenItemsHidesRecord','1','','Hide biblio record when all its items are hidden because of OpacHiddenItems','YesNo'),
398
('OpacHighlightedWords','1','','If Set, then queried words are higlighted in OPAC','YesNo'),
399
('OpacHighlightedWords','1','','If Set, then queried words are higlighted in OPAC','YesNo'),
399
('OPACHoldingsDefaultSortField','first_column','first_column|homebranch|holdingbranch','Default sort field for the holdings table at the OPAC','choice'),
400
('OPACHoldingsDefaultSortField','first_column','first_column|homebranch|holdingbranch','Default sort field for the holdings table at the OPAC','choice'),
400
('OPACHoldsIfAvailableAtPickup','1','','Allow to pickup up holds at libraries where the item is available','YesNo'),
401
('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 (+7 lines)
Lines 638-643 OPAC: Link Here
638
        -
638
        -
639
            - "List of patron categories, separated by |, that can see items otherwise hidden by <code>OpacHiddenItems</code>:"
639
            - "List of patron categories, separated by |, that can see items otherwise hidden by <code>OpacHiddenItems</code>:"
640
            - pref: OpacHiddenItemsExceptions
640
            - pref: OpacHiddenItemsExceptions
641
        -
642
            - pref: OpacHiddenItemsHidesRecord
643
              default: 1
644
              choices:
645
                  no: "Don't hide"
646
                  yes: Hide
647
            - "biblio record when all its items are hidden by <code>OpacHiddenItems</code>."
641
        -
648
        -
642
            - pref: OpacAllowPublicListCreation
649
            - pref: OpacAllowPublicListCreation
643
              default: 1
650
              default: 1
(-)a/opac/opac-ISBDdetail.pl (-1 / +1 lines)
Lines 88-94 eval { Link Here
88
unless ( $patron and $patron->category->override_hidden_items ) {
88
unless ( $patron and $patron->category->override_hidden_items ) {
89
    # only skip this check if there's a logged in user
89
    # only skip this check if there's a logged in user
90
    # and its category overrides OpacHiddenItems
90
    # and its category overrides OpacHiddenItems
91
    if ( $biblio->hidden_in_opac({ rules => $opachiddenitems_rules }) ) {
91
    if ( C4::Context->preference('OpacHiddenItemsHidesRecord') && $biblio->hidden_in_opac({ rules => $opachiddenitems_rules }) ) {
92
        print $query->redirect('/cgi-bin/koha/errors/404.pl'); # escape early
92
        print $query->redirect('/cgi-bin/koha/errors/404.pl'); # escape early
93
        exit;
93
        exit;
94
    }
94
    }
(-)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 94-100 foreach my $biblionumber ( @bibs ) { Link Here
94
    my @hidden_items     = GetHiddenItemnumbers({ items => \@all_items, borcat => $borcat });
94
    my @hidden_items     = GetHiddenItemnumbers({ items => \@all_items, borcat => $borcat });
95
95
96
    # If every item is hidden, then the biblio should be hidden too.
96
    # If every item is hidden, then the biblio should be hidden too.
97
    next if (scalar @all_items >= 1 && scalar @hidden_items == scalar @all_items);
97
    next if ( C4::Context->preference('OpacHiddenItemsHidesRecord') && scalar @all_items >= 1 && scalar @hidden_items == scalar @all_items);
98
98
99
    # copy the visible ones into the items array.
99
    # copy the visible ones into the items array.
100
    my @items;
100
    my @items;
(-)a/opac/opac-detail.pl (-1 / +1 lines)
Lines 107-113 if ( scalar @all_items >= 1 ) { Link Here
107
    push @hiddenitems,
107
    push @hiddenitems,
108
      GetHiddenItemnumbers( { items => \@all_items, borcat => $borcat } );
108
      GetHiddenItemnumbers( { items => \@all_items, borcat => $borcat } );
109
109
110
    if (scalar @hiddenitems == scalar @all_items ) {
110
    if ( C4::Context->preference('OpacHiddenItemsHidesRecord') && scalar @hiddenitems == scalar @all_items ) {
111
        print $query->redirect("/cgi-bin/koha/errors/404.pl"); # escape early
111
        print $query->redirect("/cgi-bin/koha/errors/404.pl"); # escape early
112
        exit;
112
        exit;
113
    }
113
    }
(-)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