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

(-)a/Koha/Item/Template.pm (-3 / +11 lines)
Lines 41-47 sub store { Link Here
41
    my ($self) = @_;
41
    my ($self) = @_;
42
42
43
    if ( ref( $self->contents ) eq 'HASH' ) {
43
    if ( ref( $self->contents ) eq 'HASH' ) {
44
        $self->contents( encode_json( $self->contents ) );
44
        $self->contents( $self->_json->encode( $self->contents ) );
45
    }
45
    }
46
46
47
    $self = $self->SUPER::store;
47
    $self = $self->SUPER::store;
Lines 56-66 Returns a deserilized perl structure of the JSON formatted contents Link Here
56
sub decoded_contents {
56
sub decoded_contents {
57
    my ($self) = @_;
57
    my ($self) = @_;
58
58
59
    return decode_json( encode_utf8($self->contents) ) if $self->contents;
59
    return $self->_json->decode($self->contents) if $self->contents;
60
}
60
}
61
61
62
=head2 Internal methods
62
=head2 Internal methods
63
63
64
=head3 _json
65
66
=cut
67
68
sub _json {
69
    my $self = shift;
70
    $self->{_json} //= JSON->new; # Keep utf8 off !
71
}
72
64
=head3 _type
73
=head3 _type
65
74
66
=cut
75
=cut
67
- 

Return to bug 24606