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

(-)a/installer/data/mysql/mandatory/sysprefs.sql (+2 lines)
Lines 413-418 INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` Link Here
413
('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'),
413
('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'),
414
('OpacHiddenItemsExceptions','',NULL,'List of borrower categories, separated by |, that can see items otherwise hidden by OpacHiddenItems','Textarea'),
414
('OpacHiddenItemsExceptions','',NULL,'List of borrower categories, separated by |, that can see items otherwise hidden by OpacHiddenItems','Textarea'),
415
('OpacHiddenItemsHidesRecord','1','','Hide biblio record when all its items are hidden because of OpacHiddenItems','YesNo'),
415
('OpacHiddenItemsHidesRecord','1','','Hide biblio record when all its items are hidden because of OpacHiddenItems','YesNo'),
416
('OpacHiddenRecordRedirect','0','Redirect the opac detail page for records hidden by OpacHiddenItems to an explanatory page (otherwise redirect to 404 error page)','','YesNo'),
417
('OpacHiddenRecordMessage','','Display this message on the redirect page for hidden biblios','70|10','Textarea'),
416
('OpacHighlightedWords','1','','If Set, then queried words are higlighted in OPAC','YesNo'),
418
('OpacHighlightedWords','1','','If Set, then queried words are higlighted in OPAC','YesNo'),
417
('OPACHoldingsDefaultSortField','first_column','first_column|homebranch|holdingbranch','Default sort field for the holdings table at the OPAC','choice'),
419
('OPACHoldingsDefaultSortField','first_column','first_column|homebranch|holdingbranch','Default sort field for the holdings table at the OPAC','choice'),
418
('OPACHoldsHistory','0','','If ON, enables display of Patron Holds History in OPAC','YesNo'),
420
('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 (+9 lines)
Lines 662-667 OPAC: Link Here
662
                  0: "Don't hide"
662
                  0: "Don't hide"
663
                  1: Hide
663
                  1: Hide
664
            - "the bibliographic record when all its items are hidden by <a href='/cgi-bin/koha/admin/preferences.pl?op=search&searchfield=OpacHiddenItems'>OpacHiddenItems</a>."
664
            - "the bibliographic record when all its items are hidden by <a href='/cgi-bin/koha/admin/preferences.pl?op=search&searchfield=OpacHiddenItems'>OpacHiddenItems</a>."
665
            - <br />Redirect the opac detail page for hidden records to
666
            - pref: OpacHiddenRecordRedirect
667
              choices:
668
                  1: "an explanatory page ('This record is blocked')."
669
                  0: "the 404 error page ('Not found')."
670
            - "<br />Display the following message on the redirect page for suppressed bibliographic records:"
671
            - pref: OpacHiddenRecordMessage
672
              type: textarea
673
              class: code
665
        -
674
        -
666
            - pref: OpacAllowPublicListCreation
675
            - pref: OpacAllowPublicListCreation
667
              default: 1
676
              default: 1
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-blocked.tt (-2 / +8 lines)
Lines 1-4 Link Here
1
[% USE raw %]
1
[% USE raw %]
2
[% USE Koha %]
2
[% INCLUDE 'doc-head-open.inc' %]
3
[% INCLUDE 'doc-head-open.inc' %]
3
<title>
4
<title>
4
    Record blocked &rsaquo;
5
    Record blocked &rsaquo;
Lines 31-39 Link Here
31
                <div id="opac-blocked-message" class="maincontent">
32
                <div id="opac-blocked-message" class="maincontent">
32
                    <h1>Blocked</h1>
33
                    <h1>Blocked</h1>
33
                    <p>You are not authorized to view this record.</p>
34
                    <p>You are not authorized to view this record.</p>
34
                    [% IF ( OpacSuppressionMessage ) %]
35
                    [% IF hidden %]
36
                        [% SET OpacBlockedMessage = Koha.Preference("OpacHiddenRecordMessage") %]
37
                    [% ELSE %]
38
                        [% SET OpacBlockedMessage = Koha.Preference("OpacSuppressionMessage") %]
39
                    [% END %]
40
                    [% IF ( OpacBlockedMessage ) %]
35
                        <div id="opacsuppressionmessage">
41
                        <div id="opacsuppressionmessage">
36
                            [% OpacSuppressionMessage | $raw %]
42
                            [% OpacBlockedMessage | $raw %]
37
                        </div>
43
                        </div>
38
                    [% END %]
44
                    [% END %]
39
                </div>
45
                </div>
(-)a/opac/opac-blocked.pl (-1 / +3 lines)
Lines 33-38 my ( $template, $borrowernumber, $cookie ) = get_template_and_user( Link Here
33
    }
33
    }
34
);
34
);
35
35
36
$template->param ( OpacSuppressionMessage => C4::Context->preference('OpacSuppressionMessage'));
36
if ( $query->param('hidden') ) {
37
    $template->param( hidden => 1 );
38
}
37
39
38
output_with_http_headers $query, $cookie, $template->output, 'html';
40
output_with_http_headers $query, $cookie, $template->output, 'html';
(-)a/opac/opac-detail.pl (-2 / +5 lines)
Lines 103-109 unless ( $patron and $patron->category->override_hidden_items ) { Link Here
103
    # only skip this check if there's a logged in user
103
    # only skip this check if there's a logged in user
104
    # and its category overrides OpacHiddenItems
104
    # and its category overrides OpacHiddenItems
105
    if ( $biblio->hidden_in_opac({ rules => C4::Context->yaml_preference('OpacHiddenItems') }) ) {
105
    if ( $biblio->hidden_in_opac({ rules => C4::Context->yaml_preference('OpacHiddenItems') }) ) {
106
        print $query->redirect('/cgi-bin/koha/errors/404.pl'); # escape early
106
        if ( C4::Context->preference("OpacHiddenRecordRedirect") ) {
107
            print $query->redirect("/cgi-bin/koha/opac-blocked.pl?hidden=1");
108
        } else {
109
            print $query->redirect('/cgi-bin/koha/errors/404.pl'); # escape early
110
        }
107
        exit;
111
        exit;
108
    }
112
    }
109
    if ( scalar @all_items >= 1 ) {
113
    if ( scalar @all_items >= 1 ) {
110
- 

Return to bug 27734