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

(-)a/C4/Circulation.pm (-1 / +2 lines)
Lines 22-27 use Modern::Perl; Link Here
22
use DateTime;
22
use DateTime;
23
use POSIX qw( floor );
23
use POSIX qw( floor );
24
use YAML::XS;
24
use YAML::XS;
25
use Encode;
25
26
26
use Koha::DateUtils;
27
use Koha::DateUtils;
27
use C4::Context;
28
use C4::Context;
Lines 2016-2022 sub AddReturn { Link Here
2016
    if ($yaml) {
2017
    if ($yaml) {
2017
        $yaml = "$yaml\n\n";  # YAML is anal on ending \n. Surplus does not hurt
2018
        $yaml = "$yaml\n\n";  # YAML is anal on ending \n. Surplus does not hurt
2018
        my $rules;
2019
        my $rules;
2019
        eval { $rules = YAML::XS::Load($yaml); };
2020
        eval { $rules = YAML::XS::Load(Encode::encode_utf8($yaml)); };
2020
        if ($@) {
2021
        if ($@) {
2021
            warn "Unable to parse UpdateNotForLoanStatusOnCheckin syspref : $@";
2022
            warn "Unable to parse UpdateNotForLoanStatusOnCheckin syspref : $@";
2022
        }
2023
        }
(-)a/C4/Context.pm (-1 / +1 lines)
Lines 445-451 the value cannot be properly decoded as YAML. Link Here
445
sub yaml_preference {
445
sub yaml_preference {
446
    my ( $self, $preference ) = @_;
446
    my ( $self, $preference ) = @_;
447
447
448
    my $yaml = eval { YAML::XS::Load( $self->preference( $preference ) ); };
448
    my $yaml = eval { YAML::XS::Load( Encode::encode_utf8( $self->preference( $preference ) ) ); };
449
    if ($@) {
449
    if ($@) {
450
        warn "Unable to parse $preference syspref : $@";
450
        warn "Unable to parse $preference syspref : $@";
451
        return;
451
        return;
(-)a/C4/Items.pm (-1 / +2 lines)
Lines 49-54 BEGIN { Link Here
49
49
50
use Carp;
50
use Carp;
51
use Try::Tiny;
51
use Try::Tiny;
52
use Encode;
52
use C4::Context;
53
use C4::Context;
53
use C4::Koha;
54
use C4::Koha;
54
use C4::Biblio;
55
use C4::Biblio;
Lines 982-988 sub GetHiddenItemnumbers { Link Here
982
    $yaml = "$yaml\n\n"; # YAML is anal on ending \n. Surplus does not hurt
983
    $yaml = "$yaml\n\n"; # YAML is anal on ending \n. Surplus does not hurt
983
    my $hidingrules;
984
    my $hidingrules;
984
    eval {
985
    eval {
985
        $hidingrules = YAML::XS::Load($yaml);
986
        $hidingrules = YAML::XS::Load(Encode::encode_utf8($yaml));
986
    };
987
    };
987
    if ($@) {
988
    if ($@) {
988
        warn "Unable to parse OpacHiddenItems syspref : $@";
989
        warn "Unable to parse OpacHiddenItems syspref : $@";
(-)a/C4/Record.pm (-1 / +2 lines)
Lines 30-35 use C4::Biblio; #marc2bibtex Link Here
30
use C4::Koha; #marc2csv
30
use C4::Koha; #marc2csv
31
use C4::XSLT ();
31
use C4::XSLT ();
32
use YAML::XS; #marcrecords2csv
32
use YAML::XS; #marcrecords2csv
33
use Encode;
33
use Template;
34
use Template;
34
use Text::CSV::Encoded; #marc2csv
35
use Text::CSV::Encoded; #marc2csv
35
use Koha::Items;
36
use Koha::Items;
Lines 800-806 sub marc2bibtex { Link Here
800
    my $additional_fields;
801
    my $additional_fields;
801
    if ($BibtexExportAdditionalFields) {
802
    if ($BibtexExportAdditionalFields) {
802
        $BibtexExportAdditionalFields = "$BibtexExportAdditionalFields\n\n";
803
        $BibtexExportAdditionalFields = "$BibtexExportAdditionalFields\n\n";
803
        $additional_fields = eval { YAML::XS::Load($BibtexExportAdditionalFields); };
804
        $additional_fields = eval { YAML::XS::Load(Encode::encode_utf8($BibtexExportAdditionalFields)); };
804
        if ($@) {
805
        if ($@) {
805
            warn "Unable to parse BibtexExportAdditionalFields : $@";
806
            warn "Unable to parse BibtexExportAdditionalFields : $@";
806
            $additional_fields = undef;
807
            $additional_fields = undef;
(-)a/C4/Ris.pm (-1 / +2 lines)
Lines 64-69 use Modern::Perl; Link Here
64
64
65
use List::MoreUtils qw/uniq/;
65
use List::MoreUtils qw/uniq/;
66
use YAML::XS;
66
use YAML::XS;
67
use Encode;
67
use vars qw(@ISA @EXPORT);
68
use vars qw(@ISA @EXPORT);
68
69
69
use Koha::SimpleMARC qw(read_field);
70
use Koha::SimpleMARC qw(read_field);
Lines 120-126 sub marc2ris { Link Here
120
    my $ris_additional_fields;
121
    my $ris_additional_fields;
121
    if ($RisExportAdditionalFields) {
122
    if ($RisExportAdditionalFields) {
122
        $RisExportAdditionalFields = "$RisExportAdditionalFields\n\n";
123
        $RisExportAdditionalFields = "$RisExportAdditionalFields\n\n";
123
        $ris_additional_fields = eval { YAML::XS::Load($RisExportAdditionalFields); };
124
        $ris_additional_fields = eval { YAML::XS::Load(Encode::encode_utf8($RisExportAdditionalFields)); };
124
        if ($@) {
125
        if ($@) {
125
            warn "Unable to parse RisExportAdditionalFields : $@";
126
            warn "Unable to parse RisExportAdditionalFields : $@";
126
            $ris_additional_fields = undef;
127
            $ris_additional_fields = undef;
(-)a/Koha/Filter/MARC/EmbedItems.pm (-1 / +1 lines)
Lines 31-37 my $biblio = Koha::Biblios->find( Link Here
31
my $opachiddenitems_rules;
31
my $opachiddenitems_rules;
32
eval {
32
eval {
33
    my $yaml = C4::Context->preference('OpacHiddenItems') . "\n\n";
33
    my $yaml = C4::Context->preference('OpacHiddenItems') . "\n\n";
34
    $opachiddenitems_rules = YAML::XS::Load($yaml);
34
    $opachiddenitems_rules = YAML::XS::Load(Encode::encode_utf8($yaml));
35
};
35
};
36
36
37
my @items  = grep { !$_->hidden_in_opac({ rules => $opachiddenitems_rules }) @{$biblio->items};
37
my @items  = grep { !$_->hidden_in_opac({ rules => $opachiddenitems_rules }) @{$biblio->items};
(-)a/about.pl (-1 / +2 lines)
Lines 34-39 use Config; Link Here
34
use Search::Elasticsearch;
34
use Search::Elasticsearch;
35
use Try::Tiny;
35
use Try::Tiny;
36
use YAML::XS;
36
use YAML::XS;
37
use Encode;
37
38
38
use C4::Output;
39
use C4::Output;
39
use C4::Auth;
40
use C4::Auth;
Lines 429-435 my @bad_yaml_prefs; Link Here
429
foreach my $syspref (@yaml_prefs) {
430
foreach my $syspref (@yaml_prefs) {
430
    my $yaml = C4::Context->preference( $syspref );
431
    my $yaml = C4::Context->preference( $syspref );
431
    if ( $yaml ) {
432
    if ( $yaml ) {
432
        eval { YAML::XS::Load( "$yaml\n\n" ); };
433
        eval { YAML::XS::Load( Encode::encode_utf8("$yaml\n\n") ); };
433
        if ($@) {
434
        if ($@) {
434
            push @bad_yaml_prefs, $syspref;
435
            push @bad_yaml_prefs, $syspref;
435
        }
436
        }
(-)a/acqui/addorderiso2709.pl (-2 / +3 lines)
Lines 26-31 use CGI qw ( -utf8 ); Link Here
26
use Carp;
26
use Carp;
27
use YAML::XS;
27
use YAML::XS;
28
use List::MoreUtils qw/uniq/;
28
use List::MoreUtils qw/uniq/;
29
use Encode;
29
30
30
use C4::Context;
31
use C4::Context;
31
use C4::Auth;
32
use C4::Auth;
Lines 678-684 sub get_infos_syspref { Link Here
678
    my $syspref = C4::Context->preference($syspref_name);
679
    my $syspref = C4::Context->preference($syspref_name);
679
    $syspref = "$syspref\n\n"; # YAML is anal on ending \n. Surplus does not hurt
680
    $syspref = "$syspref\n\n"; # YAML is anal on ending \n. Surplus does not hurt
680
    my $yaml = eval {
681
    my $yaml = eval {
681
        YAML::XS::Load($syspref);
682
        YAML::XS::Load(Encode::encode_utf8($syspref));
682
    };
683
    };
683
    if ( $@ ) {
684
    if ( $@ ) {
684
        warn "Unable to parse $syspref syspref : $@";
685
        warn "Unable to parse $syspref syspref : $@";
Lines 724-730 sub get_infos_syspref_on_item { Link Here
724
    my $syspref = C4::Context->preference($syspref_name);
725
    my $syspref = C4::Context->preference($syspref_name);
725
    $syspref = "$syspref\n\n"; # YAML is anal on ending \n. Surplus does not hurt
726
    $syspref = "$syspref\n\n"; # YAML is anal on ending \n. Surplus does not hurt
726
    my $yaml = eval {
727
    my $yaml = eval {
727
        YAML::XS::Load($syspref);
728
        YAML::XS::Load(Encode::encode_utf8($syspref));
728
    };
729
    };
729
    if ( $@ ) {
730
    if ( $@ ) {
730
        warn "Unable to parse $syspref syspref : $@";
731
        warn "Unable to parse $syspref syspref : $@";
(-)a/circ/pendingreserves.pl (-1 / +2 lines)
Lines 22-27 use Modern::Perl; Link Here
22
use constant PULL_INTERVAL => 2;
22
use constant PULL_INTERVAL => 2;
23
use List::MoreUtils qw( uniq );
23
use List::MoreUtils qw( uniq );
24
use YAML::XS;
24
use YAML::XS;
25
use Encode;
25
26
26
use C4::Context;
27
use C4::Context;
27
use C4::Output;
28
use C4::Output;
Lines 110-116 if ( $op eq 'cancel_reserve' and $reserve_id ) { Link Here
110
        if ( my $yaml = C4::Context->preference('UpdateItemWhenLostFromHoldList') ) {
111
        if ( my $yaml = C4::Context->preference('UpdateItemWhenLostFromHoldList') ) {
111
            $yaml = "$yaml\n\n";  # YAML is anal on ending \n. Surplus does not hurt
112
            $yaml = "$yaml\n\n";  # YAML is anal on ending \n. Surplus does not hurt
112
            my $assignments;
113
            my $assignments;
113
            eval { $assignments = YAML::XS::Load($yaml); };
114
            eval { $assignments = YAML::XS::Load(Encode::encode_utf8($yaml)); };
114
            if ($@) {
115
            if ($@) {
115
                warn "Unable to parse UpdateItemWhenLostFromHoldList syspref : $@" if $@;
116
                warn "Unable to parse UpdateItemWhenLostFromHoldList syspref : $@" if $@;
116
            }
117
            }
(-)a/opac/opac-ISBDdetail.pl (-1 / +2 lines)
Lines 41-46 the items attached to the biblio Link Here
41
41
42
use Modern::Perl;
42
use Modern::Perl;
43
use YAML::XS;
43
use YAML::XS;
44
use Encode;
44
45
45
use C4::Auth;
46
use C4::Auth;
46
use C4::Context;
47
use C4::Context;
Lines 83-89 my $patron = Koha::Patrons->find($loggedinuser); Link Here
83
my $opachiddenitems_rules;
84
my $opachiddenitems_rules;
84
eval {
85
eval {
85
    my $yaml = C4::Context->preference('OpacHiddenItems') . "\n\n";
86
    my $yaml = C4::Context->preference('OpacHiddenItems') . "\n\n";
86
    $opachiddenitems_rules = YAML::XS::Load($yaml);
87
    $opachiddenitems_rules = YAML::XS::Load(Encode::encode_utf8($yaml));
87
};
88
};
88
89
89
unless ( $patron and $patron->category->override_hidden_items ) {
90
unless ( $patron and $patron->category->override_hidden_items ) {
(-)a/opac/opac-search.pl (-2 / +2 lines)
Lines 31-36 use C4::Context; Link Here
31
use List::MoreUtils q/any/;
31
use List::MoreUtils q/any/;
32
use Try::Tiny;
32
use Try::Tiny;
33
use YAML::XS;
33
use YAML::XS;
34
use Encode;
34
35
35
use Data::Dumper; # TODO remove
36
use Data::Dumper; # TODO remove
36
37
Lines 246-252 my $yaml = C4::Context->preference('OpacHiddenItems'); Link Here
246
if ( $yaml =~ /\S/ ) {
247
if ( $yaml =~ /\S/ ) {
247
    $yaml = "$yaml\n\n"; # YAML expects trailing newline. Surplus does not hurt.
248
    $yaml = "$yaml\n\n"; # YAML expects trailing newline. Surplus does not hurt.
248
    eval {
249
    eval {
249
        $hidingrules = YAML::XS::Load($yaml);
250
        $hidingrules = YAML::XS::Load(Encode::encode_utf8($yaml));
250
    };
251
    };
251
    if ($@) {
252
    if ($@) {
252
        warn "Unable to parse OpacHiddenItems syspref : $@";
253
        warn "Unable to parse OpacHiddenItems syspref : $@";
253
- 

Return to bug 27673