@@ -, +, @@ (OPAC) - send a list via email with the english version. - translate templates and retry with another language. --- opac/opac-sendshelf.pl | 31 ++++++++++++++++++++++--------- 1 file changed, 22 insertions(+), 9 deletions(-) --- a/opac/opac-sendshelf.pl +++ a/opac/opac-sendshelf.pl @@ -21,7 +21,7 @@ use strict; use warnings; use CGI; -use Encode; +use Encode qw(decode encode); use Carp; use Mail::Sendmail; @@ -122,19 +122,32 @@ if ( $email ) { # Getting template result my $template_res = $template2->output(); + my $body; # Analysing information and getting mail properties - $mail{'subject'} = $template_res =~ /\n(.*)\n?/s - ? $1 : "no subject"; + if ( $template_res =~ /(.*)/s ) { + $mail{subject} = $1; + $mail{subject} =~ s|\n?(.*)\n?|$1|; + } + else { $mail{'subject'} = "no subject"; } - my ($email_header) = $template_res =~ /
\n(.*)\n?/s; + my $email_header = ""; + if ( $template_res =~ /
(.*)/s ) { + $email_header = $1; + $email_header =~ s|\n?(.*)\n?|$1|; + } - my $email_file = $template_res =~ /\n(.*)\n?/s - ? $1 - : "list.txt"; + my $email_file = "list.txt"; + if ( $template_res =~ /(.*)/s ) { + $email_file = $1; + $email_file =~ s|\n?(.*)\n?|$1|; + } - my ($body) = $template_res =~ /\n(.*)\n?/s; - $body = encode_qp($body); + if ( $template_res =~ /(.*)/s ) { + $body = $1; + $body =~ s|\n?(.*)\n?|$1|; + $body = encode("UTF-8", encode_qp($body)); + } my $boundary = "====" . time() . "===="; --