[freeside-commits] branch FREESIDE_4_BRANCH updated. 605828762e3553da730e101d65fe7ae143ddc7fb

Mitch Jackson mitch at freeside.biz
Wed Jan 30 04:16:31 PST 2019


The branch, FREESIDE_4_BRANCH has been updated
       via  605828762e3553da730e101d65fe7ae143ddc7fb (commit)
      from  44cff6ff89f50eb856dee0adb8fab6b1abd5310b (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 605828762e3553da730e101d65fe7ae143ddc7fb
Author: Mitch Jackson <mitch at freeside.biz>
Date:   Wed Jan 30 07:06:01 2019 -0500

    RT# 76181 Invoice date format can set locale from Freeside conf
    
    Invoice date formatting chooses localization from
    * invoice customer record $cust_main->locale
    * or FS::Conf 'locale'
    * or fallback en_US

diff --git a/FS/FS/cust_main_Mixin.pm b/FS/FS/cust_main_Mixin.pm
index 6a2e9058c..c36b79a8a 100644
--- a/FS/FS/cust_main_Mixin.pm
+++ b/FS/FS/cust_main_Mixin.pm
@@ -660,13 +660,13 @@ sub time2str_local {
 
   $self->{_date_format} ||= {};
   if (!exists($self->{_dh})) {
-    my $cust_main = $self->cust_main;
-    my $locale = $cust_main->locale  if $cust_main;
-    $locale ||= 'en_US';
+    my $locale = $self->cust_main->locale if $self->cust_main;
+    $locale ||= FS::Conf->new->config('locale') || 'en_US';
+
     my %info = FS::Locales->locale_info($locale);
-    my $dh = eval { Date::Language->new($info{'name'}) } ||
-             Date::Language->new(); # fall back to English
-    $self->{_dh} = $dh;
+
+    $self->{_dh} = eval { Date::Language->new($info{'name'}) }
+      || Date::Language->new(); # fall back to English
   }
 
   if ($format eq 'short') {

-----------------------------------------------------------------------

Summary of changes:
 FS/FS/cust_main_Mixin.pm | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)




More information about the freeside-commits mailing list