Bugzilla – Attachment 21869 Details for
Bug 9218
intranet cart email broken for non english templates
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 9218: intranet cart email broken for non english templates
Bug-9218-intranet-cart-email-broken-for-non-englis.patch (text/plain), 9.74 KB, created by
Jonathan Druart
on 2013-10-08 08:55:42 UTC
(
hide
)
Description:
Bug 9218: intranet cart email broken for non english templates
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2013-10-08 08:55:42 UTC
Size:
9.74 KB
patch
obsolete
>From 5be25e9f5955ed60596d868a86c22ba83fe49418 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@biblibre.com> >Date: Tue, 8 Oct 2013 10:52:28 +0200 >Subject: [PATCH] Bug 9218: intranet cart email broken for non english > templates > >This patch adapts the method from OPAC to the staff interface (cf bug 8062). > >Test plan: >- add somes notices to the cart >- try to send the cart by email >- the email should be the same as before >- translate templates and retry with another language. Before this patch, > the email was empty. With this patch, it contains the list of records > and items. >--- > basket/sendbasket.pl | 16 +- > .../prog/en/modules/basket/sendbasket.tt | 174 ++++++++++++++++---- > 2 files changed, 156 insertions(+), 34 deletions(-) > >diff --git a/basket/sendbasket.pl b/basket/sendbasket.pl >index 66f73fa..3f57de2 100755 >--- a/basket/sendbasket.pl >+++ b/basket/sendbasket.pl >@@ -112,22 +112,28 @@ if ( $email_add ) { > my $body; > > # Analysing information and getting mail properties >- if ( $template_res =~ /<SUBJECT>\n(.*)\n<END_SUBJECT>/s ) { >- $mail{'subject'} = $1; >+ if ( $template_res =~ /<SUBJECT>(.*)<END_SUBJECT>/s ) { >+ $mail{subject} = $1; >+ $mail{subject} =~ s|\n?(.*)\n?|$1|; > } > else { $mail{'subject'} = "no subject"; } > > my $email_header = ""; >- if ( $template_res =~ /<HEADER>\n(.*)\n<END_HEADER>/s ) { >+ if ( $template_res =~ /<HEADER>(.*)<END_HEADER>/s ) { > $email_header = $1; >+ $email_header =~ s|\n?(.*)\n?|$1|; > } > > my $email_file = "basket.txt"; >- if ( $template_res =~ /<FILENAME>\n(.*)\n<END_FILENAME>/s ) { >+ if ( $template_res =~ /<FILENAME>(.*)<END_FILENAME>/s ) { > $email_file = $1; >+ $email_file =~ s|\n?(.*)\n?|$1|; > } > >- if ( $template_res =~ /<MESSAGE>\n(.*)\n<END_MESSAGE>/s ) { $body = encode_qp($1); } >+ if ( $template_res =~ /<MESSAGE>(.*)<END_MESSAGE>/s ) { >+ $body = encode_qp($1); >+ $body =~ s|\n?(.*)\n?|$1|; >+ } > > my $boundary = "====" . time() . "===="; > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/basket/sendbasket.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/basket/sendbasket.tt >index ca8f06d..09ce7dd 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/basket/sendbasket.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/basket/sendbasket.tt >@@ -2,41 +2,157 @@ > Your cart > <END_SUBJECT> > >+[% USE HtmlToText %] >+[% myhtml FILTER html2text(leftmargin => 0, rightmargin => 0) %] >+[% myhtmltext | html2text %] >+ > <HEADER> >-Hi, > >-Here is your cart, sent from our online catalog. >+[% FILTER html2text %] >+ <p>Hi,</p> >+ >+ <p>Here is your cart, sent from our online catalog.</p> > >-Please note that the attached file is a MARC bibliographic records file >-which can be imported into a Personal Bibliographic Software like EndNote, >-Reference Manager or ProCite. >+ <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 %] > <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 %] >+ >+ [% IF comment %] >+ <p>[% comment %]</p> >+ <hr/> >+ [% END %] >+ <ol> >+ [% FOREACH BIBLIO_RESULT IN BIBLIO_RESULTS %] >+ <li> >+ <span> >+ [% BIBLIO_RESULT.title %] >+ [% IF ( BIBLIO_RESULT.subtitle ) %] [% BIBLIO_RESULT.subtitle %][% 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.ISBN ) %] >+ <span> >+ ISBN: [% BIBLIO_RESULT.ISBN %] >+ </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> >-- >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 9218
:
21847
|
21869
|
21874
|
22136