projects
/
freeside.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
don't barf displaying invoices for location-less customers, RT#79312
[freeside.git]
/
FS
/
FS
/
Maketext.pm
diff --git
a/FS/FS/Maketext.pm
b/FS/FS/Maketext.pm
index
965c999
..
b4a9b81
100644
(file)
--- a/
FS/FS/Maketext.pm
+++ b/
FS/FS/Maketext.pm
@@
-1,16
+1,24
@@
package FS::Maketext;
package FS::Maketext;
-
use base qw( Exporter );
use base qw( Exporter );
+
use FS::CurrentUser;
use FS::Conf;
use FS::L10N;
use HTML::Entities qw( encode_entities );
use FS::CurrentUser;
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;
our $lh;
+our $locale;
+#ask FS::UID to run this stuff for us later
+FS::UID->install_callback( sub {
+ my $conf = new FS::Conf;
+ $locale = $conf->config('locale');
+});
+
sub mt {
sub mt {
+ return '' if $_[0] eq '';
$lh ||= lh();
$lh->maketext(@_);
}
$lh ||= lh();
$lh->maketext(@_);
}
@@
-20,9
+28,19
@@
sub emt {
encode_entities(mt(@_));
}
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 {
sub lh {
- my $locale = $FS::CurrentUser::CurrentUser->
option('locale')
- ||
FS::Conf->new->config('locale')
+ my $locale = $FS::CurrentUser::CurrentUser->
locale
+ ||
$locale
|| 'en_US';
$locale =~ s/_/-/g;
FS::L10N->get_handle($locale) || die "Unknown locale $locale";
|| 'en_US';
$locale =~ s/_/-/g;
FS::L10N->get_handle($locale) || die "Unknown locale $locale";