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
=head2 Internal methods
208
=head2 Internal methods
(-)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 435-441 INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` Link Here
435
('OPACFinesTab','1','','If OFF the patron fines tab in the OPAC is disabled.','YesNo'),
435
('OPACFinesTab','1','','If OFF the patron fines tab in the OPAC is disabled.','YesNo'),
436
('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'),
436
('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'),
437
('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'),
437
('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'),
438
('OpacHiddenItemsExceptions','',NULL,'List of borrower categories, separated by |, that can see items otherwise hidden by OpacHiddenItems','Textarea'),
438
('OpacHiddenItemsExceptions','',NULL,'List of borrower categories, separated by comma, that can see items otherwise hidden by OpacHiddenItems','Textarea'),
439
('OpacHiddenItemsHidesRecord','1','','Hide biblio record when all its items are hidden because of OpacHiddenItems','YesNo'),
439
('OpacHiddenItemsHidesRecord','1','','Hide biblio record when all its items are hidden because of OpacHiddenItems','YesNo'),
440
('OpacHighlightedWords','1','','If Set, then queried words are higlighted in OPAC','YesNo'),
440
('OpacHighlightedWords','1','','If Set, then queried words are higlighted in OPAC','YesNo'),
441
('OPACHoldingsDefaultSortField','first_column','first_column|homebranch|holdingbranch','Default sort field for the holdings table at the OPAC','choice'),
441
('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 631-638 OPAC: Link Here
631
              class: code
631
              class: code
632
            - 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>.
632
            - 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>.
633
        -
633
        -
634
            - '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>:'
634
            - '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>:'
635
            - pref: OpacHiddenItemsExceptions
635
            - pref: OpacHiddenItemsExceptions
636
              choices: patron-categories
637
              class: multiple
636
        -
638
        -
637
            - pref: OpacHiddenItemsHidesRecord
639
            - pref: OpacHiddenItemsHidesRecord
638
              default: 1
640
              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