Bugzilla – Attachment 9875 Details for
Bug 8062
Cart email broken for non english templates
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 8062 [SIGNED-OFF] Cart email broken for non english templates
Bug-8062-SIGNED-OFF-Cart-email-broken-for-non-engl.patch (text/plain), 8.61 KB, created by
Jonathan Druart
on 2012-06-01 11:47:05 UTC
(
hide
)
Description:
Bug 8062 [SIGNED-OFF] Cart email broken for non english templates
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2012-06-01 11:47:05 UTC
Size:
8.61 KB
patch
obsolete
>From be97b12ace8862b0ffe03ee3db67bb2057870d07 Mon Sep 17 00:00:00 2001 >From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Demians?= <f.demians@tamil.fr> >Date: Mon, 14 May 2012 09:57:50 +0200 >Subject: [PATCH] Bug 8062 [SIGNED-OFF] Cart email broken for non english > templates > >Fix basket email sent from OPAC. The email body is now generated HTML >(to be translatable), and converted into TEXT before beeing sent by >email. > >To test that it works in other language than English, you have to update >your language .po file: > > perl translate update de-DE > >Then, translated strings coming from opac-sendbasket.tt, and install the >translation: > > perl translate install de-DE > >New dependency: Template::Plugin::HtmlToText > >Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com> >--- > .../opac-tmpl/prog/en/modules/opac-sendbasket.tt | 107 ++++++++++++++----- > opac/opac-sendbasket.pl | 24 ++--- > 2 files changed, 89 insertions(+), 42 deletions(-) > >diff --git a/koha-tmpl/opac-tmpl/prog/en/modules/opac-sendbasket.tt b/koha-tmpl/opac-tmpl/prog/en/modules/opac-sendbasket.tt >index 7f64f17..501c742 100644 >--- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-sendbasket.tt >+++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-sendbasket.tt >@@ -2,41 +2,92 @@ > Your cart > <END_SUBJECT> > >-<HEADER> >-Hi, >+[% USE HtmlToText %] >+[% myhtml FILTER html2text(leftmargin => 0, rightmargin => 50) %] >+[% myhtmltext | html2text %] > >-[% firstname %] [% surname %] sent you a cart from our online catalog. >+<HEADER> >+[% FILTER html2text %] >+<p>Hi, >+</p> >+<p>[% firstname %] [% surname %] sent you a cart from our online catalog.</p> > >-Please note that the attached file is a MARC bibliographic records file >+<p>Please note that the attached file is a MARC bibliographic records file > which can be imported into personal bibliographic software like EndNote, >-Reference Manager or ProCite. >+Reference Manager or ProCite.</p> >+[% END %] > <END_HEADER> > > <MESSAGE> >---------------------------------------------- >-[% IF ( comment ) %] >-[% comment %] >-[% END %] >-[% FOREACH BIBLIO_RESULT IN BIBLIO_RESULTS %][% BIBLIO_RESULT.title %][% IF ( BIBLIO_RESULT.subtitle ) %] [% BIBLIO_RESULT.subtitle %][% END %][% IF ( BIBLIO_RESULT.HASAUTHORS ) %] >-Author(s): [% IF ( BIBLIO_RESULT.author ) %][% BIBLIO_RESULT.author %][% END %][% IF ( BIBLIO_RESULT.MARCAUTHORS ) %][% IF ( BIBLIO_RESULT.author ) %]; [% END %][% FOREACH MARCAUTHOR IN BIBLIO_RESULT.MARCAUTHORS %][% FOREACH MARCAUTHOR_SUBFIELDS_LOO IN MARCAUTHOR.MARCAUTHOR_SUBFIELDS_LOOP %][% MARCAUTHOR_SUBFIELDS_LOO.separator %][% MARCAUTHOR_SUBFIELDS_LOO.value %][% END %][% UNLESS ( loop.last ) %]; [% ELSE %][% END %][% END %][% END %][% END %][% IF ( BIBLIO_RESULT.ISBN ) %] >-ISBN: [% BIBLIO_RESULT.ISBN %][% END %] >-[% IF ( BIBLIO_RESULT.publishercode ) %]Published by: [% BIBLIO_RESULT.publishercode %][% END %][% IF ( BIBLIO_RESULT.publicationyear ) %] in [% END %][% BIBLIO_RESULT.publicationyear %][% IF ( BIBLIO_RESULT.pages ) %], [% END %][% BIBLIO_RESULT.pages %][% IF ( BIBLIO_RESULT.size ) %], [% END %][% BIBLIO_RESULT.size %][% IF ( BIBLIO_RESULT.collection ) %] >-Collection: [% BIBLIO_RESULT.seriestitle %][% END %][% IF ( BIBLIO_RESULT.subject ) %] >-Subject: [% BIBLIO_RESULT.subject %][% END %][% IF ( BIBLIO_RESULT.copyrightdate ) %] >-Copyright year: [% BIBLIO_RESULT.copyrightdate %][% END %][% IF ( BIBLIO_RESULT.notes ) %] >-Notes : [% BIBLIO_RESULT.notes %][% END %][% IF ( BIBLIO_RESULT.unititle ) %] >-Unified title: [% BIBLIO_RESULT.unititle %][% END %][% IF ( BIBLIO_RESULT.serial ) %] >-Serial: [% BIBLIO_RESULT.serial %][% END %][% IF ( BIBLIO_RESULT.dewey ) %] >-Dewey: [% BIBLIO_RESULT.dewey %][% END %][% IF ( BIBLIO_RESULT.classification ) %] >-Classification: [% BIBLIO_RESULT.classification %][% END %][% IF ( BIBLIO_RESULT.lccn ) %] >-LCCN: [% BIBLIO_RESULT.lccn %][% END %][% IF ( BIBLIO_RESULT.url ) %] >-URL : [% BIBLIO_RESULT.url %][% END %] >-In the online catalog: >-[% OPACBaseURL %]/cgi-bin/koha/opac-detail.pl?biblionumber=[% BIBLIO_RESULT.biblionumber |url %] >-Items : [% FOREACH ITEM_RESULT IN BIBLIO_RESULT.ITEM_RESULTS %] >- [% ITEM_RESULT.branchname %] [% ITEM_RESULT.location %] [% IF ( ITEM_RESULT.itemcallnumber ) %]([% ITEM_RESULT.itemcallnumber %])[% END %] [% ITEM_RESULT.barcode %][% END %] >+[% FILTER html2text %] >+<hr/> > >---------------------------------------------- >+[% IF comment %] >+<p>[% comment %]</p> >+<hr/> >+[% END %] > >+<ol> >+[% FOREACH BIBLIO_RESULT IN BIBLIO_RESULTS %] >+<li> >+<a href="[% OPACBaseURL %]/cgi-bin/koha/opac-detail.pl?biblionumber= [% BIBLIO_RESULT.biblionumber %]">[% BIBLIO_RESULT.title %]</a> >+[% IF ( BIBLIO_RESULT.subtitle ) %] [% BIBLIO_RESULT.subtitle %][% END %] >+<ul> >+[% IF ( BIBLIO_RESULT.HASAUTHORS ) %] >+<li>Author(s): [% IF ( BIBLIO_RESULT.author ) %][% BIBLIO_RESULT.author %][% END %][% IF ( BIBLIO_RESULT.MARCAUTHORS ) %][% IF ( BIBLIO_RESULT.author ) %]; [% END %][% FOREACH MARCAUTHOR IN BIBLIO_RESULT.MARCAUTHORS %][% FOREACH MARCAUTHOR_SUBFIELDS_LOO IN MARCAUTHOR.MARCAUTHOR_SUBFIELDS_LOOP %][% MARCAUTHOR_SUBFIELDS_LOO.separator %][% MARCAUTHOR_SUBFIELDS_LOO.value %][% END %][% UNLESS ( loop.last ) %]; [% ELSE %][% END %][% END %][% END %][% END %]</li> >+[% IF ( BIBLIO_RESULT.ISBN ) %] >+<li>ISBN: [% BIBLIO_RESULT.ISBN %]</li> >+[% END %] >+[% IF BIBLIO_RESULT.publishercode %] >+<li> >+Published by: [% BIBLIO_RESULT.publishercode %][% IF ( BIBLIO_RESULT.publicationyear ) %] in [% BIBLIO_RESULT.publicationyear %][% END %][% IF ( BIBLIO_RESULT.pages ) %], [% BIBLIO_RESULT.pages %][% END %][% IF BIBLIO_RESULT.size %], [% BIBLIO_RESULT.size %][% END %] >+</li> >+[% END %] >+[% IF BIBLIO_RESULT.collection %] >+<li>Collection: [% BIBLIO_RESULT.seriestitle %]</li> >+[% END %] >+[% IF ( BIBLIO_RESULT.subject ) %] >+<li>Subject: [% BIBLIO_RESULT.subject %]<li> >+[% END %] >+[% IF ( BIBLIO_RESULT.copyrightdate ) %] >+<li>Copyright year: [% BIBLIO_RESULT.copyrightdate %]</li> >+[% END %] >+[% IF ( BIBLIO_RESULT.notes ) %] >+<li>Notes : [% BIBLIO_RESULT.notes %]</li> >+[% END %] >+[% IF ( BIBLIO_RESULT.unititle ) %] >+<li>Unified title: [% BIBLIO_RESULT.unititle %]</li> >+[% END %] >+[% IF ( BIBLIO_RESULT.serial ) %] >+<li>Serial: [% BIBLIO_RESULT.serial %]</li> >+[% END %] >+[% IF ( BIBLIO_RESULT.dewey ) %] >+<li>Dewey: [% BIBLIO_RESULT.dewey %]</li> >+[% END %] >+[% IF ( BIBLIO_RESULT.classification ) %] >+<li>Classification: [% BIBLIO_RESULT.classification %]</li> >+[% END %] >+[% IF ( BIBLIO_RESULT.lccn ) %] >+<li>LCCN: [% BIBLIO_RESULT.lccn %]</li> >+[% END %] >+[% IF ( BIBLIO_RESULT.url ) %] >+<li>URL : [% BIBLIO_RESULT.url %]</li> >+[% END %] >+<li>Items: >+<ul> >+[% FOREACH ITEM_RESULT IN BIBLIO_RESULT.ITEM_RESULTS %] >+<li> >+[% ITEM_RESULT.branchname %] >+[% ITEM_RESULT.location %] >+[% IF ITEM_RESULT.itemcallnumber %]([% ITEM_RESULT.itemcallnumber %])[% END %] >+[% ITEM_RESULT.barcode %] >+</li> >+[% END %] >+</ul> >+</ul> >+</li> >+[% END %] >+</ol> > [% END %] > <END_MESSAGE> >+ >diff --git a/opac/opac-sendbasket.pl b/opac/opac-sendbasket.pl >index 57d2c79..57c2d41 100755 >--- a/opac/opac-sendbasket.pl >+++ b/opac/opac-sendbasket.pl >@@ -27,6 +27,7 @@ use Carp; > use Mail::Sendmail; > use MIME::QuotedPrint; > use MIME::Base64; >+use HTML::FormatText; > use C4::Biblio; > use C4::Items; > use C4::Auth; >@@ -120,39 +121,34 @@ if ( $email_add ) { > my $body; > > # Analysing information and getting mail properties >- if ( $template_res =~ /<SUBJECT>\n(.*)\n<END_SUBJECT>/s ) { >+ if ( $template_res =~ /<SUBJECT>\n(.*)\n?<END_SUBJECT>/s ) { > $mail{'subject'} = $1; > } > else { $mail{'subject'} = "no subject"; } > > my $email_header = ""; >- if ( $template_res =~ /<HEADER>\n(.*)\n<END_HEADER>/s ) { >+ if ( $template_res =~ /<HEADER>\n(.*)\n?<END_HEADER>/s ) { > $email_header = $1; > } > > my $email_file = "basket.txt"; >- if ( $template_res =~ /<FILENAME>\n(.*)\n<END_FILENAME>/s ) { >+ if ( $template_res =~ /<FILENAME>\n(.*)\n?<END_FILENAME>/s ) { > $email_file = $1; > } > >- if ( $template_res =~ /<MESSAGE>\n(.*)\n<END_MESSAGE>/s ) { $body = encode_qp($1); } >- >+ if ( $template_res =~ /<MESSAGE>\n(.*)\n?<END_MESSAGE>/s ) { >+ $body = $1; >+ } >+ > my $boundary = "====" . time() . "===="; > >- # $mail{'content-type'} = "multipart/mixed; boundary=\"$boundary\""; >- # >- # $email_header = encode_qp($email_header); >- # >- # $boundary = "--".$boundary; >- # >- # # Writing mail >- # $mail{body} = > $mail{'content-type'} = "multipart/mixed; boundary=\"$boundary\""; > my $isofile = encode_base64(encode("UTF-8", $iso2709)); > $boundary = '--' . $boundary; > $mail{body} = <<END_OF_BODY; > $boundary >-Content-Type: text/plain; charset="utf-8" >+MIME-Version: 1.0 >+Content-Type: text/plain; charset="UTF-8" > Content-Transfer-Encoding: quoted-printable > > $email_header >-- >1.7.7.3
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 8062
:
9551
|
9572
|
9875
|
9908
|
9940
|
10969