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

(-)a/Koha/Patron/Category.pm (-1 / +1 lines)
Lines 202-208 TODO: Remove on bug 22547 Link Here
202
sub override_hidden_items {
202
sub override_hidden_items {
203
    my ($self) = @_;
203
    my ($self) = @_;
204
    return any { $_ eq $self->categorycode }
204
    return any { $_ eq $self->categorycode }
205
    split( /\|/, C4::Context->preference('OpacHiddenItemsExceptions') );
205
    split( ',', C4::Context->preference('OpacHiddenItemsExceptions') );
206
}
206
}
207
207
208
=head3 can_make_suggestions
208
=head3 can_make_suggestions
(-)a/installer/data/mysql/atomicupdate/bug_31577_OpacHiddenItemsExceptions.pl (+18 lines)
Line 0 Link Here
1
use Modern::Perl;
2
3
return {
4
    bug_number => "31577",
5
    description => "Add category list pull-down to OpacHiddenItemsExceptions",
6
    up => sub {
7
        my ($args) = @_;
8
        my ($dbh, $out) = @$args{qw(dbh out)};
9
        # Do you stuffs here
10
        $dbh->do(q{
11
            UPDATE systempreferences SET value = REPLACE(value,"|",","),
12
            explanation = REPLACE(explanation,"separated by |,","separated by comma,")
13
            WHERE variable = "OpacHiddenItemsExceptions"
14
        });
15
        # Print useful stuff here
16
        say $out "Settings for OpacHiddenItemsExceptions have been updated";
17
    },
18
};
(-)a/installer/data/mysql/mandatory/sysprefs.sql (-1 / +1 lines)
Lines 441-447 INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` Link Here
441
('OPACFinesTab','1','','If OFF the patron fines tab in the OPAC is disabled.','YesNo'),
441
('OPACFinesTab','1','','If OFF the patron fines tab in the OPAC is disabled.','YesNo'),
442
('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'),
442
('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'),
443
('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'),
443
('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'),
444
('OpacHiddenItemsExceptions','',NULL,'List of borrower categories, separated by |, that can see items otherwise hidden by OpacHiddenItems','Textarea'),
444
('OpacHiddenItemsExceptions','',NULL,'List of borrower categories, separated by comma, that can see items otherwise hidden by OpacHiddenItems','Textarea'),
445
('OpacHiddenItemsHidesRecord','1','','Hide biblio record when all its items are hidden because of OpacHiddenItems','YesNo'),
445
('OpacHiddenItemsHidesRecord','1','','Hide biblio record when all its items are hidden because of OpacHiddenItems','YesNo'),
446
('OpacHighlightedWords','1','','If Set, then queried words are higlighted in OPAC','YesNo'),
446
('OpacHighlightedWords','1','','If Set, then queried words are higlighted in OPAC','YesNo'),
447
('OPACHoldingsDefaultSortField','first_column','first_column|homebranch|holdingbranch','Default sort field for the holdings table at the OPAC','choice'),
447
('OPACHoldingsDefaultSortField','first_column','first_column|homebranch|holdingbranch','Default sort field for the holdings table at the OPAC','choice'),
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref (-1 / +3 lines)
Lines 592-599 OPAC: Link Here
592
              class: code
592
              class: code
593
            - Define custom rules to hide specific items from search and view on the OPAC. How to write these rules is documented on the <a href="http://wiki.koha-community.org/wiki/OpacHiddenItems" target="_blank">Koha wiki</a>.
593
            - Define custom rules to hide specific items from search and view on the OPAC. How to write these rules is documented on the <a href="http://wiki.koha-community.org/wiki/OpacHiddenItems" target="_blank">Koha wiki</a>.
594
        -
594
        -
595
            - '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>:'
595
            - 'List of patron categories, that can see items otherwise hidden by <a href="/cgi-bin/koha/admin/preferences.pl?op=search&searchfield=OpacHiddenItems">OpacHiddenItems</a>:'
596
            - pref: OpacHiddenItemsExceptions
596
            - pref: OpacHiddenItemsExceptions
597
              choices: patron-categories
598
              class: multiple
597
        -
599
        -
598
            - pref: OpacHiddenItemsHidesRecord
600
            - pref: OpacHiddenItemsHidesRecord
599
              default: 1
601
              default: 1
(-)a/t/db_dependent/Koha/Patron/Category.t (-3 / +2 lines)
Lines 155-166 subtest 'override_hidden_items() tests' => sub { Link Here
155
    my $category_1 = $builder->build_object({ class => 'Koha::Patron::Categories' });
155
    my $category_1 = $builder->build_object({ class => 'Koha::Patron::Categories' });
156
    my $category_2 = $builder->build_object({ class => 'Koha::Patron::Categories' });
156
    my $category_2 = $builder->build_object({ class => 'Koha::Patron::Categories' });
157
157
158
    t::lib::Mocks::mock_preference( 'OpacHiddenItemsExceptions', $category_1->categorycode . '|' . $category_2->categorycode . '|RANDOM' );
158
    t::lib::Mocks::mock_preference( 'OpacHiddenItemsExceptions', $category_1->categorycode . ',' . $category_2->categorycode . ',RANDOM' );
159
159
160
    ok( $category_1->override_hidden_items, 'Category configured to override' );
160
    ok( $category_1->override_hidden_items, 'Category configured to override' );
161
    ok( $category_2->override_hidden_items, 'Category configured to override' );
161
    ok( $category_2->override_hidden_items, 'Category configured to override' );
162
162
163
    t::lib::Mocks::mock_preference( 'OpacHiddenItemsExceptions', 'RANDOM|' . $category_2->categorycode );
163
    t::lib::Mocks::mock_preference( 'OpacHiddenItemsExceptions', 'RANDOM,' . $category_2->categorycode );
164
164
165
    ok( !$category_1->override_hidden_items, 'Category not configured to override' );
165
    ok( !$category_1->override_hidden_items, 'Category not configured to override' );
166
    ok( $category_2->override_hidden_items, 'Category configured to override' );
166
    ok( $category_2->override_hidden_items, 'Category configured to override' );
167
- 

Return to bug 31577