Bugzilla – Attachment 21529 Details for
Bug 8368
List email broken for non english templates
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
[PASSED QA] Bug 8368 List email broken for non english templates
PASSED-QA-Bug-8368-List-email-broken-for-non-engli.patch (text/plain), 11.65 KB, created by
Katrin Fischer
on 2013-09-27 21:17:23 UTC
(
hide
)
Description:
[PASSED QA] Bug 8368 List email broken for non english templates
Filename:
MIME Type:
Creator:
Katrin Fischer
Created:
2013-09-27 21:17:23 UTC
Size:
11.65 KB
patch
obsolete
>From 277464160df33fe466754557166935c6836d85c5 Mon Sep 17 00:00:00 2001 >From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Demians?= <f.demians@tamil.fr> >Date: Tue, 24 Sep 2013 18:34:48 +0200 >Subject: [PATCH] [PASSED QA] Bug 8368 List email broken for non english > templates > >This patch ports to list sending by email, the technic used in sending cart, ie >(1) format email in HTML, and (2) transform it into Text with TT filter >html2text. > >Note: V2 of this patch: Restore proper subtile display. >Signed-off-by: Owen Leonard <oleonard@myacpl.org> >Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de> >Fixes a very annoying translation bug successfully. >Also passes all tests and QA script. > >To test: >- Add a few records to a shelf, ideally use some with diacritics. >- Send shelf from English templates, verify email is ok >- Send shelf from translated templates (de-DE or similar) - verify > email content is broken. >- Apply patches, update po files and reinstall the language. >- Send shelf from English templates again, verify there is no > regression. >- Send shelf form translates templates - verify this email is now > also working correctly. > >Patch also changes the name of the file attachement from shelf.iso2709 >to list.iso2709. >--- > .../opac-tmpl/prog/en/modules/opac-sendshelf.tt | 178 ++++++++++++++++---- > opac/opac-sendshelf.pl | 30 ++-- > 2 files changed, 158 insertions(+), 50 deletions(-) > >diff --git a/koha-tmpl/opac-tmpl/prog/en/modules/opac-sendshelf.tt b/koha-tmpl/opac-tmpl/prog/en/modules/opac-sendshelf.tt >index c43affb..12ba757 100644 >--- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-sendshelf.tt >+++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-sendshelf.tt >@@ -2,45 +2,157 @@ > Your list : [% shelfname %] > <END_SUBJECT> > >+[% USE HtmlToText %] >+[% myhtml FILTER html2text(leftmargin => 0, rightmargin => 0) %] >+[% myhtmltext | html2text %] >+ > <HEADER> >-Hi, >+[% FILTER html2text %] >+ <p>Hi,</p> >+ >+ <p>[% firstname %] [% surname %] sent you from our online catalog, the >+ virtual shelf called : [% shelfname %].</p> > >-[% firstname %] [% surname %], sent you from our online catalog, the virtual shelf called : [% shelfname %]. >+ <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.</p> >+ <hr/> >+[% END %] > >-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. > <END_HEADER> > > <MESSAGE> >---------------------------------------------- >-[% IF ( comment ) %] >-[% comment %] >-[% END %] >-[% FOREACH BIBLIO_RESULT IN BIBLIO_RESULTS %][% BIBLIO_RESULT.title %][% IF ( BIBLIO_RESULT.subtitle.size ) %] [% FOREACH subtitle IN BIBLIO_RESULT.subtitle %][% subtitle.subfield %][% END %][% END %][% IF ( BIBLIO_RESULT.author ) %] >- >-by [% BIBLIO_RESULT.author %][% END %] >-[% IF ( BIBLIO_RESULT.MARCAUTHORS.size ) %] >-Additional author(s): [% 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 %][% 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 %][% IF ( OPACBaseURL ) %] >-In the online catalog: >- http://[% OPACBaseURL %]/cgi-bin/koha/opac-detail.pl?biblionumber=[% BIBLIO_RESULT.biblionumber |url %][% END %] >-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 %] >+ >+ [% IF comment %] >+ <p>[% comment %]</p> >+ <hr/> >+ [% END %] >+ <ol> >+ [% FOREACH BIBLIO_RESULT IN BIBLIO_RESULTS %] >+ <li> >+ <span> >+ [% BIBLIO_RESULT.title %] >+ [% IF ( BIBLIO_RESULT.subtitle.size ) %] >+ [% FOREACH subtitle IN BIBLIO_RESULT.subtitle %] >+ [% subtitle.subfield %] >+ [% END %] >+ [% END %] >+ </span> >+ >+ <p> >+ [% IF ( BIBLIO_RESULT.HASAUTHORS ) %] >+ <span>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 ) %];[% END %] >+ [% END %] >+ [% END %] >+ </span><br/> >+ [% END %] >+ >+ [% IF BIBLIO_RESULT.publishercode %] >+ <span> >+ 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 %] >+ </span><br/> >+ [% END %] >+ >+ [% IF BIBLIO_RESULT.collection %] >+ <span> >+ Collection: [% BIBLIO_RESULT.seriestitle %] >+ </span><br/> >+ [% END %] >+ >+ [% IF ( BIBLIO_RESULT.subject ) %] >+ <span> >+ Subject: [% BIBLIO_RESULT.subject %] >+ <span><br/> >+ [% END %] >+ >+ [% IF ( BIBLIO_RESULT.copyrightdate ) %] >+ <span> >+ Copyright year: [% BIBLIO_RESULT.copyrightdate %] >+ </span><br/> >+ [% END %] >+ >+ [% IF ( BIBLIO_RESULT.notes ) %] >+ <span> >+ Notes : [% BIBLIO_RESULT.notes %] >+ </span><br/> >+ [% END %] >+ >+ [% IF ( BIBLIO_RESULT.unititle ) %] >+ <span> >+ Unified title: [% BIBLIO_RESULT.unititle %] >+ </span><br/> >+ [% END %] >+ >+ [% IF ( BIBLIO_RESULT.serial ) %] >+ <span> >+ Serial: [% BIBLIO_RESULT.serial %] >+ </span><br/> >+ [% END %] >+ >+ [% IF ( BIBLIO_RESULT.dewey ) %] >+ <span> >+ Dewey: [% BIBLIO_RESULT.dewey %] >+ </span><br/> >+ [% END %] >+ >+ [% IF ( BIBLIO_RESULT.classification ) %] >+ <span> >+ Classification: [% BIBLIO_RESULT.classification %] >+ </span><br/> >+ [% END %] >+ >+ [% IF ( BIBLIO_RESULT.lccn ) %] >+ <span> >+ LCCN: [% BIBLIO_RESULT.lccn %] >+ </span><br/> >+ [% END %] >+ [% IF ( BIBLIO_RESULT.url ) %] >+ <span> >+ URL: [% BIBLIO_RESULT.url |url %] >+ </span> >+ [% END %] >+ </p> >+ >+ [% IF ( OPACBaseURL ) %] >+ <p> >+ In online catalog: [% OPACBaseURL %]/cgi-bin/koha/opac-detail.pl?biblionumber=[% BIBLIO_RESULT.biblionumber %] >+ </p> >+ [% END %] >+ [% IF ( BIBLIO_RESULT.ITEM_RESULTS.size ) %] >+ <p>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> >+ </p> >+ [% END %] >+ <hr/> >+ </li> >+ [% END %] >+ </ol> > > [% END %] >+ > <END_MESSAGE> >diff --git a/opac/opac-sendshelf.pl b/opac/opac-sendshelf.pl >index 6e60bc9..cc70765 100755 >--- a/opac/opac-sendshelf.pl >+++ b/opac/opac-sendshelf.pl >@@ -21,7 +21,7 @@ use strict; > use warnings; > > use CGI; >-use Encode qw(encode); >+use Encode; > use Carp; > > use Mail::Sendmail; >@@ -91,12 +91,14 @@ if ( $email ) { > > my @items = GetItemsInfo( $biblionumber ); > >+ $dat->{ISBN} = GetMarcISBN($record, $marcflavour); > $dat->{MARCNOTES} = $marcnotesarray; > $dat->{MARCSUBJCTS} = $marcsubjctsarray; > $dat->{MARCAUTHORS} = $marcauthorsarray; > $dat->{'biblionumber'} = $biblionumber; > $dat->{ITEM_RESULTS} = \@items; > $dat->{subtitle} = $subtitle; >+ $dat->{HASAUTHORS} = $dat->{'author'} || @$marcauthorsarray; > > $iso2709 .= $record->as_usmarc(); > >@@ -120,25 +122,18 @@ if ( $email ) { > > # Getting template result > my $template_res = $template2->output(); >- my $body; > > # Analysing information and getting mail properties >- if ( $template_res =~ /<SUBJECT>\n(.*)\n<END_SUBJECT>/s ) { >- $mail{'subject'} = $1; >- } >- else { $mail{'subject'} = "no subject"; } >+ $mail{'subject'} = $template_res =~ /<SUBJECT>\n(.*)\n?<END_SUBJECT>/s >+ ? $1 : "no subject"; > >- my $email_header = ""; >- if ( $template_res =~ /<HEADER>\n(.*)\n<END_HEADER>/s ) { >- $email_header = $1; >- } >+ my ($email_header) = $template_res =~ /<HEADER>\n(.*)\n?<END_HEADER>/s; > >- my $email_file = "basket.txt"; >- if ( $template_res =~ /<FILENAME>\n(.*)\n<END_FILENAME>/s ) { >- $email_file = $1; >- } >+ my $email_file = $template_res =~ /<FILENAME>\n(.*)\n?<END_FILENAME>/s >+ ? $1 >+ : "list.txt"; > >- if ( $template_res =~ /<MESSAGE>\n(.*)\n<END_MESSAGE>/s ) { $body = encode_qp($1); } >+ my ($body) = $template_res =~ /<MESSAGE>\n(.*)\n?<END_MESSAGE>/s; > > my $boundary = "====" . time() . "===="; > >@@ -150,15 +145,16 @@ if ( $email ) { > > $mail{body} = <<END_OF_BODY; > $boundary >+MIME-Version: 1.0 > Content-Type: text/plain; charset="utf-8" > Content-Transfer-Encoding: quoted-printable > > $email_header > $body > $boundary >-Content-Type: application/octet-stream; name="shelf.iso2709" >+Content-Type: application/octet-stream; name="list.iso2709" > Content-Transfer-Encoding: base64 >-Content-Disposition: attachment; filename="shelf.iso2709" >+Content-Disposition: attachment; filename="list.iso2709" > > $isofile > $boundary-- >-- >1.7.9.5
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 8368
:
21427
|
21447
|
21448
|
21457
| 21529