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

(-)a/installer/data/mysql/atomicupdate/bug_27734.perl (+12 lines)
Line 0 Link Here
1
$DBversion = 'XXX';
2
if( CheckVersion( $DBversion ) ) {
3
    $dbh->do(q{
4
        INSERT IGNORE INTO systempreferences ( `variable`, `value`, `options`, `explanation`, `type` ) VALUES
5
        ('OpacHiddenRecordRedirect','0','Redirect the opac detail page for records hidden by OpacHiddenItems to an explanatory page (otherwise redirect to 404 error page)','','YesNo')
6
    });
7
    $dbh->do(q{
8
        INSERT IGNORE INTO systempreferences ( `variable`, `value`, `options`, `explanation`, `type` ) VALUES
9
        ('OpacHiddenRecordMessage','','Display this message on the redirect page for hidden biblios','70|10','Textarea')
10
    });
11
    NewVersion( $DBversion, 27734, "Add OpacHiddenRecordRedirect and OpacHiddenRecordMessage preferences");
12
}
(-)a/installer/data/mysql/mandatory/sysprefs.sql (+2 lines)
Lines 491-496 INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` Link Here
491
('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'),
491
('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'),
492
('OpacHiddenItemsExceptions','',NULL,'List of borrower categories, separated by comma, that can see items otherwise hidden by OpacHiddenItems','Textarea'),
492
('OpacHiddenItemsExceptions','',NULL,'List of borrower categories, separated by comma, that can see items otherwise hidden by OpacHiddenItems','Textarea'),
493
('OpacHiddenItemsHidesRecord','1','','Hide biblio record when all its items are hidden because of OpacHiddenItems','YesNo'),
493
('OpacHiddenItemsHidesRecord','1','','Hide biblio record when all its items are hidden because of OpacHiddenItems','YesNo'),
494
('OpacHiddenRecordRedirect','0','Redirect the opac detail page for records hidden by OpacHiddenItems to an explanatory page (otherwise redirect to 404 error page)','','YesNo'),
495
('OpacHiddenRecordMessage','','Display this message on the redirect page for hidden biblios','70|10','Textarea'),
494
('OpacHighlightedWords','1','','If Set, then queried words are higlighted in OPAC','YesNo'),
496
('OpacHighlightedWords','1','','If Set, then queried words are higlighted in OPAC','YesNo'),
495
('OPACHoldingsDefaultSortField','first_column','first_column|homebranch|holdingbranch','Default sort field for the holdings table at the OPAC','choice'),
497
('OPACHoldingsDefaultSortField','first_column','first_column|homebranch|holdingbranch','Default sort field for the holdings table at the OPAC','choice'),
496
('OpacHoldNotes','0','','Show hold notes on OPAC','YesNo'),
498
('OpacHoldNotes','0','','Show hold notes on OPAC','YesNo'),
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref (+9 lines)
Lines 641-646 OPAC: Link Here
641
                  0: "Don't hide"
641
                  0: "Don't hide"
642
                  1: Hide
642
                  1: Hide
643
            - "the bibliographic record when all its items are hidden by <a href='/cgi-bin/koha/admin/preferences.pl?op=search&searchfield=OpacHiddenItems'>OpacHiddenItems</a>."
643
            - "the bibliographic record when all its items are hidden by <a href='/cgi-bin/koha/admin/preferences.pl?op=search&searchfield=OpacHiddenItems'>OpacHiddenItems</a>."
644
            - <br />Redirect the opac detail page for hidden records to
645
            - pref: OpacHiddenRecordRedirect
646
              choices:
647
                  1: "an explanatory page ('This record is blocked')."
648
                  0: "the 404 error page ('Not found')."
649
            - "<br />Display the following message on the redirect page for suppressed bibliographic records:"
650
            - pref: OpacHiddenRecordMessage
651
              type: textarea
652
              class: code
644
        -
653
        -
645
            - pref: OpacAllowPublicListCreation
654
            - pref: OpacAllowPublicListCreation
646
              default: 1
655
              default: 1
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-blocked.tt (-1 / +7 lines)
Lines 3-8 Link Here
3
[% SET OpacSuppressionMessage = AdditionalContents.get( location => "OpacSuppressionMessage", lang => lang, library => branchcode || default_branch ) %]
3
[% SET OpacSuppressionMessage = AdditionalContents.get( location => "OpacSuppressionMessage", lang => lang, library => branchcode || default_branch ) %]
4
[% PROCESS 'i18n.inc' %]
4
[% PROCESS 'i18n.inc' %]
5
[% PROCESS 'html_helpers.inc' %]
5
[% PROCESS 'html_helpers.inc' %]
6
[% USE Koha %]
6
[% INCLUDE 'doc-head-open.inc' %]
7
[% INCLUDE 'doc-head-open.inc' %]
7
<title>[% FILTER collapse %]
8
<title>[% FILTER collapse %]
8
    [% t("Record blocked") | html %] &rsaquo;
9
    [% t("Record blocked") | html %] &rsaquo;
Lines 26-32 Link Here
26
                <div id="opac-blocked-message" class="maincontent">
27
                <div id="opac-blocked-message" class="maincontent">
27
                    <h1>Record blocked</h1>
28
                    <h1>Record blocked</h1>
28
                    <p>You are not authorized to view this record.</p>
29
                    <p>You are not authorized to view this record.</p>
29
                    [% IF ( OpacSuppressionMessage ) %]
30
                    [% IF hidden %]
31
                        [% SET OpacBlockedMessage = Koha.Preference("OpacHiddenRecordMessage") %]
32
                    [% ELSE %]
33
                        [% SET OpacBlockedMessage = Koha.Preference("OpacSuppressionMessage") %]
34
                    [% END %]
35
                    [% IF ( OpacBlockedMessage ) %]
30
                        <div id="opacsuppressionmessage">
36
                        <div id="opacsuppressionmessage">
31
                            [% PROCESS koha_news_block news => OpacSuppressionMessage %]
37
                            [% PROCESS koha_news_block news => OpacSuppressionMessage %]
32
                        </div>
38
                        </div>
(-)a/opac/opac-blocked.pl (+4 lines)
Lines 33-36 my ( $template, $borrowernumber, $cookie ) = get_template_and_user( Link Here
33
    }
33
    }
34
);
34
);
35
35
36
if ( $query->param('hidden') ) {
37
    $template->param( hidden => 1 );
38
}
39
36
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 123-129 unless ( $patron and $patron->category->override_hidden_items ) { Link Here
123
    # only skip this check if there's a logged in user
123
    # only skip this check if there's a logged in user
124
    # and its category overrides OpacHiddenItems
124
    # and its category overrides OpacHiddenItems
125
    if ( $biblio->hidden_in_opac({ rules => C4::Context->yaml_preference('OpacHiddenItems') }) ) {
125
    if ( $biblio->hidden_in_opac({ rules => C4::Context->yaml_preference('OpacHiddenItems') }) ) {
126
        print $query->redirect('/cgi-bin/koha/errors/404.pl'); # escape early
126
        if ( C4::Context->preference("OpacHiddenRecordRedirect") ) {
127
            print $query->redirect("/cgi-bin/koha/opac-blocked.pl?hidden=1");
128
        } else {
129
            print $query->redirect('/cgi-bin/koha/errors/404.pl'); # escape early
130
        }
127
        exit;
131
        exit;
128
    }
132
    }
129
    if ( $items->count >= 1 ) {
133
    if ( $items->count >= 1 ) {
130
- 

Return to bug 27734