From b039292fdc4797830865e6ddd3e2a0986326f92c Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Mon, 17 Mar 2014 13:33:43 +0100 Subject: [PATCH] Bug 11944: TT Plugins should not encode strings Signed-off-by: Paola Rossi Signed-off-by: Bernardo Gonzalez Kriegel Signed-off-by: Dobrica Pavlinusic --- Koha/Template/Plugin/AuthorisedValues.pm | 7 ++----- Koha/Template/Plugin/Branches.pm | 5 ++--- Koha/Template/Plugin/ItemTypes.pm | 1 - 3 files changed, 4 insertions(+), 9 deletions(-) diff --git a/Koha/Template/Plugin/AuthorisedValues.pm b/Koha/Template/Plugin/AuthorisedValues.pm index 0198ab4..36ddce1 100644 --- a/Koha/Template/Plugin/AuthorisedValues.pm +++ b/Koha/Template/Plugin/AuthorisedValues.pm @@ -21,13 +21,11 @@ use Modern::Perl; use Template::Plugin; use base qw( Template::Plugin ); -use Encode qw{encode is_utf8}; - use C4::Koha; sub GetByCode { my ( $self, $category, $code, $opac ) = @_; - return encode( 'UTF-8', GetAuthorisedValueByCode( $category, $code, $opac ) ); + return GetAuthorisedValueByCode( $category, $code, $opac ); } sub Get { @@ -65,8 +63,7 @@ The parameters are identical to those used by the subroutine C4::Koha::GetAuthor sub GetByCode { my ( $self, $category, $code, $opac ) = @_; - my $av = GetAuthorisedValueByCode( $category, $code, $opac ); - return $av; + return GetAuthorisedValueByCode( $category, $code, $opac ); } =head2 GetAuthValueDropbox diff --git a/Koha/Template/Plugin/Branches.pm b/Koha/Template/Plugin/Branches.pm index 781cd21..92db535 100644 --- a/Koha/Template/Plugin/Branches.pm +++ b/Koha/Template/Plugin/Branches.pm @@ -21,7 +21,6 @@ use Modern::Perl; use Template::Plugin; use base qw( Template::Plugin ); -use Encode qw{encode is_utf8}; use C4::Koha; use C4::Context; @@ -33,7 +32,7 @@ sub GetName { my $sth = C4::Context->dbh->prepare($query); $sth->execute($branchcode); my $b = $sth->fetchrow_hashref(); - return $b->{branchname}; + return $b ? $b->{'branchname'} : q{}; } sub GetLoggedInBranchcode { @@ -51,7 +50,7 @@ sub GetURL { my $sth = C4::Context->dbh->prepare($query); $sth->execute($branchcode); my $b = $sth->fetchrow_hashref(); - return encode( 'UTF-8', $b->{'branchurl'} ); + return $b->{branchurl}; } 1; diff --git a/Koha/Template/Plugin/ItemTypes.pm b/Koha/Template/Plugin/ItemTypes.pm index c913189..941ce03 100644 --- a/Koha/Template/Plugin/ItemTypes.pm +++ b/Koha/Template/Plugin/ItemTypes.pm @@ -21,7 +21,6 @@ use Modern::Perl; use Template::Plugin; use base qw( Template::Plugin ); -use Encode qw{encode decode}; use C4::Koha; -- 1.7.2.5