summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorivan <ivan>2011-07-27 23:56:54 +0000
committerivan <ivan>2011-07-27 23:56:54 +0000
commitbfe65f7f510efb468acd581158b7307d498eb003 (patch)
treee6bd452305d062bd19fd289cad7d76fea47a9e81
parent0835b63c6fdd56c14f4a7c8e2541e734b7687e0f (diff)
fix i18n of javascript re-print/email confirmations, RT#12515
-rw-r--r--FS/FS/Maketext.pm12
-rw-r--r--FS/FS/Mason.pm3
-rwxr-xr-xhttemplate/search/cust_bill.html10
3 files changed, 18 insertions, 7 deletions
diff --git a/FS/FS/Maketext.pm b/FS/FS/Maketext.pm
index 965c999..ccfc120 100644
--- a/FS/FS/Maketext.pm
+++ b/FS/FS/Maketext.pm
@@ -6,7 +6,7 @@ use FS::Conf;
use FS::L10N;
use HTML::Entities qw( encode_entities );
-our @EXPORT_OK = qw( mt emt );
+our @EXPORT_OK = qw( mt emt js_mt );
our $lh;
@@ -20,6 +20,16 @@ sub emt {
encode_entities(mt(@_));
}
+# Javascript-escaped version of mt()
+sub js_mt {
+ my $s = mt(@_);
+ #false laziness w/Mason.pm
+ $s =~ s/(['\\])/\\$1/g;
+ $s =~ s/\r/\\r/g;
+ $s =~ s/\n/\\n/g;
+ $s = "'$s'";
+}
+
sub lh {
my $locale = $FS::CurrentUser::CurrentUser->option('locale')
|| FS::Conf->new->config('locale')
diff --git a/FS/FS/Mason.pm b/FS/FS/Mason.pm
index 934004e..3691975 100644
--- a/FS/FS/Mason.pm
+++ b/FS/FS/Mason.pm
@@ -140,7 +140,7 @@ if ( -e $addl_handler_use_file ) {
use FS::NetworkMonitoringSystem;
use FS::Tron qw( tron_lint );
use FS::Locales;
- use FS::Maketext qw( mt emt );
+ use FS::Maketext qw( mt emt js_mt );
use FS::agent;
use FS::agent_type;
@@ -526,6 +526,7 @@ sub mason_interps {
my $html_defang = new HTML::Defang (%defang_opts);
+ #false laziness w/ FS::Maketext js_mt
my $js_string_sub = sub {
#${$_[0]} =~ s/(['\\\n])/'\\'.($1 eq "\n" ? 'n' : $1)/ge;
${$_[0]} =~ s/(['\\])/\\$1/g;
diff --git a/httemplate/search/cust_bill.html b/httemplate/search/cust_bill.html
index 6277036..4117112 100755
--- a/httemplate/search/cust_bill.html
+++ b/httemplate/search/cust_bill.html
@@ -205,31 +205,31 @@ my $html_init = join("\n", map {
'<SCRIPT TYPE="text/javascript">
function confirm_print_process() {
- if ( ! confirm('.emt("Are you sure you want to reprint these invoices?").') ) {
+ if ( ! confirm('.js_mt("Are you sure you want to reprint these invoices?").') ) {
return;
}
print_process();
}
function confirm_email_process() {
- if ( ! confirm('.emt("Are you sure you want to re-email these invoices?").') ) {
+ if ( ! confirm('.js_mt("Are you sure you want to re-email these invoices?").') ) {
return;
}
email_process();
}
function confirm_fax_process() {
- if ( ! confirm('.emt("Are you sure you want to re-fax these invoices?").') ) {
+ if ( ! confirm('.js_mt("Are you sure you want to re-fax these invoices?").') ) {
return;
}
fax_process();
}
function confirm_ftp_process() {
- if ( ! confirm('.emt("Are you sure you want to re-FTP these invoices?").') ) {
+ if ( ! confirm('.js_mt("Are you sure you want to re-FTP these invoices?").') ) {
return;
}
ftp_process();
}
function confirm_spool_process() {
- if ( ! confirm('.emt("Are you sure you want to re-spool these invoices?").') ) {
+ if ( ! confirm('.js_mt("Are you sure you want to re-spool these invoices?").') ) {
return;
}
spool_process();