Bugzilla – Attachment 27585 Details for
Bug 11944
Cleanup Koha UTF-8
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 11944: Remove all utf8 filter from templates
Bug-11944-Remove-all-utf8-filter-from-templates.patch (text/plain), 12.26 KB, created by
Jonathan Druart
on 2014-04-25 09:45:15 UTC
(
hide
)
Description:
Bug 11944: Remove all utf8 filter from templates
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2014-04-25 09:45:15 UTC
Size:
12.26 KB
patch
obsolete
>From 6890ebc77b25c8269c1882d8e698dbc4f45b60f9 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@biblibre.com> >Date: Fri, 14 Mar 2014 09:16:16 +0100 >Subject: [PATCH] Bug 11944: Remove all utf8 filter from templates > >This patch >- removes all html_entity usages in tt file which hide utf8 bugs >- removes all encode utf8 in tt plugins because we should get correctly > marked data from DBIC and other sources directly (cf plugin EncodeUTF8 > used in renew.tt) >- adds some cleanup in C4::Templates::output: we now use perl utf8 file > handler output so we don't need to decode tt variables manually. > >Signed-off-by: Paola Rossi <paola.rossi@cineca.it> >--- > C4/Charset.pm | 2 +- > C4/Templates.pm | 2 +- > Koha/Template/Plugin/AuthorisedValues.pm | 5 +++-- > Koha/Template/Plugin/Branches.pm | 4 ++-- > Koha/Template/Plugin/EncodeUTF8.pm | 2 +- > Koha/Template/Plugin/ItemTypes.pm | 2 +- > cataloguing/addbiblio.pl | 2 +- > koha-tmpl/intranet-tmpl/prog/en/includes/patron-search.inc | 4 ++-- > koha-tmpl/intranet-tmpl/prog/en/includes/patron-toolbar.inc | 2 +- > koha-tmpl/intranet-tmpl/prog/en/modules/circ/renew.tt | 7 +++---- > koha-tmpl/intranet-tmpl/prog/en/modules/members/pay.tt | 2 +- > koha-tmpl/opac-tmpl/prog/en/modules/opac-account.tt | 2 +- > 12 files changed, 18 insertions(+), 18 deletions(-) > >diff --git a/C4/Charset.pm b/C4/Charset.pm >index acad92a..1774be6 100644 >--- a/C4/Charset.pm >+++ b/C4/Charset.pm >@@ -560,7 +560,7 @@ sub _marc_marc8_to_utf8 { > # occurs, upgrade the string in place. Moral of the story seems to be > # that pack("U", ...) is better than chr(...) if you need to guarantee > # that the resulting string is UTF-8. >- utf8::upgrade($utf8sf); >+ $utf8sf = Encode::encode('UTF-8', $utf8sf); > } > push @converted_subfields, $subfield->[0], $utf8sf; > } >diff --git a/C4/Templates.pm b/C4/Templates.pm >index 0b49862..2c5d2c1 100644 >--- a/C4/Templates.pm >+++ b/C4/Templates.pm >@@ -128,7 +128,7 @@ sub output { > } > } > my $data; >-# binmode( STDOUT, ":utf8" ); >+ binmode( STDOUT, ":utf8" ); > $template->process( $self->filename, $vars, \$data ) > || die "Template process failed: ", $template->error(); > return $data; >diff --git a/Koha/Template/Plugin/AuthorisedValues.pm b/Koha/Template/Plugin/AuthorisedValues.pm >index 0a19be2..5b37f68 100644 >--- a/Koha/Template/Plugin/AuthorisedValues.pm >+++ b/Koha/Template/Plugin/AuthorisedValues.pm >@@ -22,7 +22,7 @@ use Modern::Perl; > use Template::Plugin; > use base qw( Template::Plugin ); > >-use Encode qw{encode decode}; >+use Encode qw{encode is_utf8}; > > use C4::Koha; > >@@ -40,7 +40,8 @@ The parameters are identical to those used by the subroutine C4::Koha::GetAuthor > > sub GetByCode { > my ( $self, $category, $code, $opac ) = @_; >- return encode( 'UTF-8', GetAuthorisedValueByCode( $category, $code, $opac ) ); >+ my $av = GetAuthorisedValueByCode( $category, $code, $opac ); >+ return $av; > } > > 1; >diff --git a/Koha/Template/Plugin/Branches.pm b/Koha/Template/Plugin/Branches.pm >index ddf5f2f..8d6359d 100644 >--- a/Koha/Template/Plugin/Branches.pm >+++ b/Koha/Template/Plugin/Branches.pm >@@ -21,7 +21,7 @@ use Modern::Perl; > > use Template::Plugin; > use base qw( Template::Plugin ); >-use Encode qw{encode decode}; >+use Encode qw{encode is_utf8}; > > use C4::Koha; > use C4::Context; >@@ -33,7 +33,7 @@ sub GetName { > my $sth = C4::Context->dbh->prepare($query); > $sth->execute($branchcode); > my $b = $sth->fetchrow_hashref(); >- return $b ? encode( 'UTF-8', $b->{'branchname'} ) : q{}; >+ return $b->{branchname}; > } > > sub GetLoggedInBranchcode { >diff --git a/Koha/Template/Plugin/EncodeUTF8.pm b/Koha/Template/Plugin/EncodeUTF8.pm >index 94fa81a..d27ccec 100644 >--- a/Koha/Template/Plugin/EncodeUTF8.pm >+++ b/Koha/Template/Plugin/EncodeUTF8.pm >@@ -25,7 +25,7 @@ use Encode qw{encode}; > > sub filter { > my ( $self, $value ) = @_; >- return encode( 'UTF-8', $value ); >+ return is_utf8( $value ) ? encode( 'UTF-8', $value ) : $value; > } > > 1; >diff --git a/Koha/Template/Plugin/ItemTypes.pm b/Koha/Template/Plugin/ItemTypes.pm >index f0edbc8..c913189 100644 >--- a/Koha/Template/Plugin/ItemTypes.pm >+++ b/Koha/Template/Plugin/ItemTypes.pm >@@ -32,7 +32,7 @@ sub GetDescription { > my $sth = C4::Context->dbh->prepare($query); > $sth->execute($itemtype); > my $d = $sth->fetchrow_hashref(); >- return encode( 'UTF-8', $d->{'description'} ); >+ return $d->{description} > > } > >diff --git a/cataloguing/addbiblio.pl b/cataloguing/addbiblio.pl >index 118bfc2..fa3e90b 100755 >--- a/cataloguing/addbiblio.pl >+++ b/cataloguing/addbiblio.pl >@@ -21,7 +21,7 @@ > > use strict; > #use warnings; FIXME - Bug 2505 >-use CGI; >+use CGI q(-utf8); > use C4::Output; > use C4::Auth; > use C4::Biblio; >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/patron-search.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/patron-search.inc >index bccd39c..f32451f 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/includes/patron-search.inc >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/patron-search.inc >@@ -63,8 +63,8 @@ > <p><label for="categorycode">Category: </label><select name="categorycode" id="categorycode"> > <option value="">Any</option>[% FOREACH categorie IN categories %] > [% IF ( categorie.selected ) %] >- <option value="[% categorie.categorycode %]" selected="selected">[% categorie.description |html_entity %]</option>[% ELSE %] >- <option value="[% categorie.categorycode %]">[% categorie.description |html_entity %]</option>[% END %] >+ <option value="[% categorie.categorycode %]" selected="selected">[% categorie.description %]</option>[% ELSE %] >+ <option value="[% categorie.categorycode %]">[% categorie.description %]</option>[% END %] > [% END %]</select></p> > [% END %] > </div> >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/patron-toolbar.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/patron-toolbar.inc >index 8d36da3..c8ff82d 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/includes/patron-toolbar.inc >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/patron-toolbar.inc >@@ -4,7 +4,7 @@ > <button class="btn btn-small dropdown-toggle" data-toggle="dropdown"><i class="icon-plus"></i> New patron <span class="caret"></span></button> > <ul class="dropdown-menu"> > [% IF ( AddPatronLists_categorycode ) %] >- [% FOREACH categorie IN categories %]<li><a href="/cgi-bin/koha/members/memberentry.pl?op=add&categorycode=[% categorie.categorycode %]">[% categorie.description | html_entity %]</a></li>[% END %] >+ [% FOREACH categorie IN categories %]<li><a href="/cgi-bin/koha/members/memberentry.pl?op=add&categorycode=[% categorie.categorycode %]">[% categorie.description %]</a></li>[% END %] > [% ELSE %] > <li><a href="/cgi-bin/koha/members/memberentry.pl?op=add&category_type=A">Adult patron</a></li> > <li><a href="/cgi-bin/koha/members/memberentry.pl?op=add&category_type=C">Child patron</a></li> >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/renew.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/renew.tt >index 3ebd006..1a9db9c 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/renew.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/renew.tt >@@ -1,6 +1,5 @@ > [% USE Koha %] > [% USE KohaDates %] >-[% USE EncodeUTF8 %] > > [% INCLUDE 'doc-head-open.inc' %] > >@@ -40,11 +39,11 @@ > > [% ELSIF error == "no_checkout" %] > >- <p><a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% item.biblionumber %]">[% item.biblio.title | $EncodeUTF8 %] [% item.biblioitem.subtitle | $EncodeUTF8 %]</a> ( <a href="/cgi-bin/koha/catalogue/moredetail.pl?itemnumber=[% item.itemnumber %]&biblionumber=[% item.biblionumber %]&bi=[% item.biblioitemnumber %]#item[% item.itemnumber %]">[% item.barcode %]</a> ) is not checked out to a patron.</p> >+ <p><a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% item.biblionumber %]">[% item.biblio.title %] [% item.biblioitem.subtitle %]</a> ( <a href="/cgi-bin/koha/catalogue/moredetail.pl?itemnumber=[% item.itemnumber %]&biblionumber=[% item.biblionumber %]&bi=[% item.biblioitemnumber %]#item[% item.itemnumber %]">[% item.barcode %]</a> ) is not checked out to a patron.</p> > > [% ELSIF error == "too_many" %] > >- <p>[% item.biblio.title | $EncodeUTF8 %] [% item.biblioitem.subtitle | $EncodeUTF8 %] ( [% item.barcode %] ) has been renewed the maximum number of times by [% borrower.firstname %] [% borrower.surname %] ( <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% borrower.borrowernumber %]"> [% borrower.cardnumber %] </a> )</p> >+ <p>[% item.biblio.title %] [% item.biblioitem.subtitle %] ( [% item.barcode %] ) has been renewed the maximum number of times by [% borrower.firstname %] [% borrower.surname %] ( <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% borrower.borrowernumber %]"> [% borrower.cardnumber %] </a> )</p> > > [% IF Koha.Preference('AllowRenewalLimitOverride') %] > <form method="post" action="/cgi-bin/koha/circ/renew.pl"> >@@ -97,7 +96,7 @@ > <div class="dialog message"> > <h3>Item renewed:</h3> > <p> >- <a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% item.biblionumber %]">[% item.biblio.title | $EncodeUTF8 %] [% item.biblioitem.subtitle | $EncodeUTF8 %]</a> >+ <a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% item.biblionumber %]">[% item.biblio.title %] [% item.biblioitem.subtitle %]</a> > ( <a href="/cgi-bin/koha/catalogue/moredetail.pl?itemnumber=[% item.itemnumber %]&biblionumber=[% item.biblionumber %]&bi=[% item.biblioitemnumber %]#item[% item.itemnumber %]">[% item.barcode %]</a> ) > renewed for > [% borrower.firstname %] [% borrower.surname %] ( <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% borrower.borrowernumber %]"> [% borrower.cardnumber %] </a> ) >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/pay.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/pay.tt >index 2b012d3..169de9d 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/pay.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/pay.tt >@@ -126,7 +126,7 @@ function enableCheckboxActions(){ > [% CASE %][% line.accounttype %] > [%- END -%] > [%- IF line.description %], [% line.description %][% END %] >- [% IF line.title %]([% line.title |html_entity %])[% END %] >+ [% IF line.title %]([% line.title %])[% END %] > </td> > <td><input type="text" name="payment_note_[% line.accountno %]" /></td> > <td>[% line.accounttype %]</td> >diff --git a/koha-tmpl/opac-tmpl/prog/en/modules/opac-account.tt b/koha-tmpl/opac-tmpl/prog/en/modules/opac-account.tt >index 47169e8..d988c8a 100644 >--- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-account.tt >+++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-account.tt >@@ -51,7 +51,7 @@ > [% CASE %][% ACCOUNT_LINE.accounttype %] > [%- END -%] > [%- IF ACCOUNT_LINE.description %], [% ACCOUNT_LINE.description %][% END %] >- [% IF line.title %]([% line.title |html_entity %])[% END %] >+ [% IF line.title %]([% line.title %])[% END %] > </td> > [% IF ( ACCOUNT_LINE.amountcredit ) %]<td class="credit">[% ELSE %]<td class="debit">[% END %][% ACCOUNT_LINE.amount %]</td> > [% IF ( ACCOUNT_LINE.amountoutstandingcredit ) %]<td class="credit">[% ELSE %]<td class="debit">[% END %][% ACCOUNT_LINE.amountoutstanding %]</td> >-- >1.7.10.4
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 11944
:
26364
|
26365
|
26366
|
26367
|
26368
|
26369
|
26370
|
26371
|
26372
|
26407
|
26408
|
26409
|
26737
|
26738
|
26739
|
26740
|
26741
|
26742
|
26743
|
26744
|
26745
|
26746
|
26747
|
26748
|
26794
|
26857
|
26858
|
26859
|
26860
|
26861
|
26862
|
26863
|
26864
|
26865
|
26866
|
26867
|
26868
|
26869
|
26870
|
26871
|
26895
|
26921
|
27021
|
27080
|
27094
|
27158
|
27159
|
27161
|
27193
|
27194
|
27195
|
27196
|
27198
|
27199
|
27200
|
27201
|
27202
|
27203
|
27204
|
27205
|
27206
|
27207
|
27208
|
27209
|
27210
|
27211
|
27212
|
27213
|
27214
|
27215
|
27216
|
27585
|
27586
|
27587
|
27588
|
27589
|
27590
|
27591
|
27592
|
27593
|
27594
|
27595
|
27596
|
27597
|
27598
|
27599
|
27600
|
27601
|
27602
|
27603
|
27880
|
27881
|
27882
|
27883
|
27884
|
27885
|
27886
|
27887
|
27888
|
27889
|
27890
|
27891
|
27892
|
27893
|
27894
|
27895
|
27896
|
27897
|
27898
|
28046
|
28047
|
28048
|
28049
|
28050
|
28051
|
28052
|
28053
|
28054
|
28055
|
28056
|
28057
|
28058
|
28059
|
28060
|
28061
|
28062
|
28063
|
28064
|
28065
|
28066
|
28097
|
28245
|
28246
|
28247
|
28248
|
28249
|
28250
|
28251
|
28252
|
28253
|
28732
|
29981
|
29982
|
29983
|
29984
|
29985
|
29986
|
29987
|
29988
|
29989
|
29990
|
29991
|
29992
|
29993
|
29994
|
29995
|
29996
|
29997
|
29998
|
29999
|
30000
|
30001
|
30002
|
30003
|
30004
|
30005
|
30006
|
30012
|
30016
|
30945
|
31299
|
35223
|
35224
|
35225
|
35226
|
35227
|
35228
|
35229
|
35230
|
35231
|
35232
|
35233
|
35234
|
35235
|
35236
|
35237
|
35238
|
35239
|
35240
|
35241
|
35242
|
35243
|
35244
|
35245
|
35246
|
35247
|
35248
|
35249
|
35250
|
35251
|
35252
|
35253