[freeside-commits] branch master updated. 5e8073ffe5707504751b8df36f645b325a895f87

Ivan ivan at 420.am
Thu May 3 14:35:12 PDT 2012


The branch, master has been updated
       via  5e8073ffe5707504751b8df36f645b325a895f87 (commit)
      from  79ca46c249e58be3b7c70df57a8fc75a60ceb622 (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 5e8073ffe5707504751b8df36f645b325a895f87
Author: Ivan Kohler <ivan at freeside.biz>
Date:   Thu May 3 14:35:11 2012 -0700

    add cust_main-require_locale configuration setting, RT#17594

diff --git a/FS/FS/Conf.pm b/FS/FS/Conf.pm
index 517967c..bf7c553 100644
--- a/FS/FS/Conf.pm
+++ b/FS/FS/Conf.pm
@@ -4977,6 +4977,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 845d098..cba28bc 100644
--- a/FS/FS/cust_main.pm
+++ b/FS/FS/cust_main.pm
@@ -1538,6 +1538,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';
@@ -2139,6 +2143,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 9f4cb74..0194d31 100644
--- a/httemplate/edit/cust_main/billing.html
+++ b/httemplate/edit/cust_main/billing.html
@@ -570,20 +570,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