Lines 30-36
use Modern::Perl;
Link Here
|
30 |
use C4::Context; |
30 |
use C4::Context; |
31 |
use List::MoreUtils q/any/; |
31 |
use List::MoreUtils q/any/; |
32 |
use Try::Tiny; |
32 |
use Try::Tiny; |
33 |
use YAML::XS; |
|
|
34 |
use Encode; |
33 |
use Encode; |
35 |
|
34 |
|
36 |
use Data::Dumper; # TODO remove |
35 |
use Data::Dumper; # TODO remove |
Lines 242-258
my $cnt;
Link Here
|
242 |
my $advanced_search_types = C4::Context->preference("AdvancedSearchTypes") || "itemtypes"; |
241 |
my $advanced_search_types = C4::Context->preference("AdvancedSearchTypes") || "itemtypes"; |
243 |
my @advanced_search_types = split(/\|/, $advanced_search_types); |
242 |
my @advanced_search_types = split(/\|/, $advanced_search_types); |
244 |
|
243 |
|
245 |
my $hidingrules = {}; |
244 |
my $hidingrules = C4::Context->yaml_preference('OpacHiddenItems') // {}; |
246 |
my $yaml = C4::Context->preference('OpacHiddenItems'); |
|
|
247 |
if ( $yaml =~ /\S/ ) { |
248 |
$yaml = "$yaml\n\n"; # YAML expects trailing newline. Surplus does not hurt. |
249 |
eval { |
250 |
$hidingrules = YAML::XS::Load(Encode::encode_utf8($yaml)); |
251 |
}; |
252 |
if ($@) { |
253 |
warn "Unable to parse OpacHiddenItems syspref : $@"; |
254 |
} |
255 |
} |
256 |
|
245 |
|
257 |
my @sorted_itemtypes = sort { $itemtypes->{$a}->{translated_description} cmp $itemtypes->{$b}->{translated_description} } keys %$itemtypes; |
246 |
my @sorted_itemtypes = sort { $itemtypes->{$a}->{translated_description} cmp $itemtypes->{$b}->{translated_description} } keys %$itemtypes; |
258 |
foreach my $advanced_srch_type (@advanced_search_types) { |
247 |
foreach my $advanced_srch_type (@advanced_search_types) { |
Lines 811-818
for (my $i=0;$i<@servers;$i++) {
Link Here
|
811 |
$template->param(searchdesc => 1); |
800 |
$template->param(searchdesc => 1); |
812 |
} |
801 |
} |
813 |
$template->param(results_per_page => $results_per_page); |
802 |
$template->param(results_per_page => $results_per_page); |
814 |
my $hide = C4::Context->preference('OpacHiddenItems'); |
803 |
my $hide = ($hidingrules) ? 1 : 0; |
815 |
$hide = ($hide =~ m/\S/) if $hide; # Just in case it has some spaces/new lines |
|
|
816 |
my $branch = ''; |
804 |
my $branch = ''; |
817 |
if (C4::Context->userenv){ |
805 |
if (C4::Context->userenv){ |
818 |
$branch = C4::Context->userenv->{branch}; |
806 |
$branch = C4::Context->userenv->{branch}; |
819 |
- |
|
|