From a6230544e6104fa908abe3fdff92aa37de71562a Mon Sep 17 00:00:00 2001 From: Ivan Kohler Date: Thu, 3 May 2012 14:35:12 -0700 Subject: add cust_main-require_locale configuration setting, RT#17594 --- FS/FS/Conf.pm | 7 +++++++ FS/FS/cust_main.pm | 9 +++++++++ 2 files changed, 16 insertions(+) (limited to 'FS') diff --git a/FS/FS/Conf.pm b/FS/FS/Conf.pm index f3174a733..d0c4bd426 100644 --- a/FS/FS/Conf.pm +++ b/FS/FS/Conf.pm @@ -4975,6 +4975,13 @@ and customer address. Include units.', }, 'option_sub' => sub { FS::Locales->description(shift) }, }, + + { + 'key' => 'cust_main-require_locale', + 'section' => 'UI', + 'description' => 'Require an explicit locale to be chosen for new customers.', + 'type' => 'checkbox', + }, { 'key' => 'translate-auto-insert', diff --git a/FS/FS/cust_main.pm b/FS/FS/cust_main.pm index b2373d30b..90759e76b 100644 --- a/FS/FS/cust_main.pm +++ b/FS/FS/cust_main.pm @@ -1537,6 +1537,10 @@ sub replace { $self->censusyear($conf->config('census_year')||'2012'); } + return "Invoicing locale is required" + if $old->locale + && ! $self->locale + && $conf->exists('cust_main-require_locale'); local $SIG{HUP} = 'IGNORE'; local $SIG{INT} = 'IGNORE'; @@ -2138,6 +2142,11 @@ sub check { $self->payname($1); } + return "Please select an invoicing locale" + if ! $self->locale + && ! $self->custnum + && $conf->exists('cust_main-require_locale'); + foreach my $flag (qw( tax spool_cdr squelch_cdr archived email_csv_cdr )) { $self->$flag() =~ /^(Y?)$/ or return "Illegal $flag: ". $self->$flag(); $self->$flag($1); -- cgit v1.2.1