[freeside-commits] branch FREESIDE_2_3_BRANCH updated. a6230544e6104fa908abe3fdff92aa37de71562a
Ivan
ivan at 420.am
Thu May 3 14:35:13 PDT 2012
The branch, FREESIDE_2_3_BRANCH has been updated
via a6230544e6104fa908abe3fdff92aa37de71562a (commit)
from b77cf31ec6cf130ae8f19265fec49b62484060fb (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit a6230544e6104fa908abe3fdff92aa37de71562a
Author: Ivan Kohler <ivan at freeside.biz>
Date: Thu May 3 14:35:12 2012 -0700
add cust_main-require_locale configuration setting, RT#17594
diff --git a/FS/FS/Conf.pm b/FS/FS/Conf.pm
index f3174a7..d0c4bd4 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 b2373d3..90759e7 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);
diff --git a/httemplate/edit/cust_main/billing.html b/httemplate/edit/cust_main/billing.html
index bf6c623..ddc6cc2 100644
--- a/httemplate/edit/cust_main/billing.html
+++ b/httemplate/edit/cust_main/billing.html
@@ -562,20 +562,25 @@ function toggle(obj) {
%my @available_locales = $conf->config('available-locales');
%if ( scalar(@available_locales) ) {
-% push @available_locales, '';
-% my %locale_labels = map {
-% my %ll;
-% my %info = FS::Locales->locale_info($_);
-% $ll{$_} = $info{name} . " (" . $info{country} . ")";
-% %ll;
-% } FS::Locales->locales;
- <& /elements/tr-select.html,
- 'label' => emt('Invoicing locale'),
- 'field' => 'locale',
- 'options' => \@available_locales,
- 'labels' => \%locale_labels,
- 'curr_value' => $cust_main->locale,
- &>
+% push @available_locales, ''
+% unless $cust_main->locale && $conf->exists('cust_main-require_locale');
+% my %locale_labels = map {
+% my %ll;
+% my %info = FS::Locales->locale_info($_);
+% $ll{$_} = $info{name} . " (" . $info{country} . ")";
+% %ll;
+% } FS::Locales->locales;
+%
+% my $label = ( $conf->exists('cust_main-require_locale') ? $r : '' ).
+% emt('Invoicing locale');
+
+ <& /elements/tr-select.html,
+ 'label' => $label,
+ 'field' => 'locale',
+ 'options' => \@available_locales,
+ 'labels' => \%locale_labels,
+ 'curr_value' => $cust_main->locale,
+ &>
% }
</TABLE>
-----------------------------------------------------------------------
Summary of changes:
FS/FS/Conf.pm | 7 ++++++
FS/FS/cust_main.pm | 9 ++++++++
httemplate/edit/cust_main/billing.html | 33 ++++++++++++++++++-------------
3 files changed, 35 insertions(+), 14 deletions(-)
More information about the freeside-commits
mailing list