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 497-502 INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` Link Here
497
('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'),
497
('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'),
498
('OpacHiddenItemsExceptions','',NULL,'List of borrower categories, separated by comma, that can see items otherwise hidden by OpacHiddenItems','Textarea'),
498
('OpacHiddenItemsExceptions','',NULL,'List of borrower categories, separated by comma, that can see items otherwise hidden by OpacHiddenItems','Textarea'),
499
('OpacHiddenItemsHidesRecord','1','','Hide biblio record when all its items are hidden because of OpacHiddenItems','YesNo'),
499
('OpacHiddenItemsHidesRecord','1','','Hide biblio record when all its items are hidden because of OpacHiddenItems','YesNo'),
500
('OpacHiddenRecordRedirect','0','Redirect the opac detail page for records hidden by OpacHiddenItems to an explanatory page (otherwise redirect to 404 error page)','','YesNo'),
501
('OpacHiddenRecordMessage','','Display this message on the redirect page for hidden biblios','70|10','Textarea'),
500
('OpacHighlightedWords','1','','If Set, then queried words are higlighted in OPAC','YesNo'),
502
('OpacHighlightedWords','1','','If Set, then queried words are higlighted in OPAC','YesNo'),
501
('OPACHoldingsDefaultSortField','first_column','first_column|homebranch|holdingbranch','Default sort field for the holdings table at the OPAC','choice'),
503
('OPACHoldingsDefaultSortField','first_column','first_column|homebranch|holdingbranch','Default sort field for the holdings table at the OPAC','choice'),
502
('OpacHoldNotes','0','','Show hold notes on OPAC','YesNo'),
504
('OpacHoldNotes','0','','Show hold notes on OPAC','YesNo'),
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref (+9 lines)
Lines 650-655 OPAC: Link Here
650
                  0: "Don't hide"
650
                  0: "Don't hide"
651
                  1: Hide
651
                  1: Hide
652
            - "the bibliographic record when all its items are hidden by <a href='/cgi-bin/koha/admin/preferences.pl?op=search&searchfield=OpacHiddenItems'>OpacHiddenItems</a>."
652
            - "the bibliographic record when all its items are hidden by <a href='/cgi-bin/koha/admin/preferences.pl?op=search&searchfield=OpacHiddenItems'>OpacHiddenItems</a>."
653
            - <br />Redirect the opac detail page for hidden records to
654
            - pref: OpacHiddenRecordRedirect
655
              choices:
656
                  1: "an explanatory page ('This record is blocked')."
657
                  0: "the 404 error page ('Not found')."
658
            - "<br />Display the following message on the redirect page for suppressed bibliographic records:"
659
            - pref: OpacHiddenRecordMessage
660
              type: textarea
661
              class: code
653
        -
662
        -
654
            - pref: OpacAllowPublicListCreation
663
            - pref: OpacAllowPublicListCreation
655
              default: 1
664
              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 124-130 unless ( $patron and $patron->category->override_hidden_items ) { Link Here
124
    # only skip this check if there's a logged in user
124
    # only skip this check if there's a logged in user
125
    # and its category overrides OpacHiddenItems
125
    # and its category overrides OpacHiddenItems
126
    if ( $biblio->hidden_in_opac({ rules => C4::Context->yaml_preference('OpacHiddenItems') }) ) {
126
    if ( $biblio->hidden_in_opac({ rules => C4::Context->yaml_preference('OpacHiddenItems') }) ) {
127
        print $query->redirect('/cgi-bin/koha/errors/404.pl'); # escape early
127
        if ( C4::Context->preference("OpacHiddenRecordRedirect") ) {
128
            print $query->redirect("/cgi-bin/koha/opac-blocked.pl?hidden=1");
129
        } else {
130
            print $query->redirect('/cgi-bin/koha/errors/404.pl'); # escape early
131
        }
128
        exit;
132
        exit;
129
    }
133
    }
130
    if ( $items->count >= 1 ) {
134
    if ( $items->count >= 1 ) {
131
- 

Return to bug 27734