[freeside-commits] branch FREESIDE_3_BRANCH updated. ba4c3441c41303528ad0a51efa23e916083bb3ee

Mark Wells mark at 420.am
Mon Jun 27 16:41:01 PDT 2016


The branch, FREESIDE_3_BRANCH has been updated
       via  ba4c3441c41303528ad0a51efa23e916083bb3ee (commit)
      from  8edeefb2ba59401254391ef33e223585eff20471 (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 ba4c3441c41303528ad0a51efa23e916083bb3ee
Author: Mark Wells <mark at freeside.biz>
Date:   Mon Jun 27 16:39:23 2016 -0700

    localize CDR column headings during rendering, #71331

diff --git a/FS/FS/TemplateItem_Mixin.pm b/FS/FS/TemplateItem_Mixin.pm
index 248da3c..28fbd59 100644
--- a/FS/FS/TemplateItem_Mixin.pm
+++ b/FS/FS/TemplateItem_Mixin.pm
@@ -258,14 +258,25 @@ sub details {
     $sth->execute or die $sth->errstr;
 
     #avoid the fetchall_arrayref and loop for less memory usage?
-
-    map { (defined($_->[0]) && $_->[0] eq 'C')
-            ? &{$format_sub}(      $_->[1] )
-            : &{$escape_function}( $_->[1] );
+    # probably should use a cursor...
+
+    my @return;
+    my $head = 1;
+    map {
+      my $row = $_;
+      if (defined($row->[0]) and $row->[0] eq 'C') {
+        if ($head) {
+          # first CSV row = the format header; localize it but not the others
+          $row->[1] = $self->mt($row->[1]);
+          $head = 0;
         }
-      @{ $sth->fetchall_arrayref };
+        &{$format_sub}($row->[1]);
+      } else {
+        &{$escape_function}($row->[1]);
+      }
+    } @{ $sth->fetchall_arrayref };
 
-  }
+  } #!$opt{format_function}
 
 }
 
diff --git a/FS/FS/detail_format.pm b/FS/FS/detail_format.pm
index be84680..d032100 100644
--- a/FS/FS/detail_format.pm
+++ b/FS/FS/detail_format.pm
@@ -168,7 +168,7 @@ sub header {
   my $self = shift;
 
   FS::cust_bill_pkg_detail->new(
-    { 'format' => 'C', 'detail' => $self->mt($self->header_detail) }
+    { 'format' => 'C', 'detail' => $self->header_detail }
   )
 }
 
@@ -270,10 +270,7 @@ sub time2str_local {
   $self->{_dh}->time2str(@_);
 }
 
-sub mt {
-  my $self = shift;
-  $self->{_lh}->maketext(@_);
-}
+# header strings are now localized in FS::TemplateItem_Mixin::detail
 
 #imitate previous behavior for now
 
diff --git a/httemplate/edit/msgcat.html b/httemplate/edit/msgcat.html
index 4e2edd6..5ca118a 100644
--- a/httemplate/edit/msgcat.html
+++ b/httemplate/edit/msgcat.html
@@ -3,7 +3,7 @@
      table         => 'msgcat',
      fields        => [ { field=>'msgcode', type=>'fixed' },
                         { field=>'locale',  type=>'fixed' },
-                        'msg',
+                        { field => 'msg', type => 'text', size => 60 },
                       ],
      labels        => { 'msgnum'  => 'String',
                         'msgcode' => 'Code',

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

Summary of changes:
 FS/FS/TemplateItem_Mixin.pm |   23 +++++++++++++++++------
 FS/FS/detail_format.pm      |    7 ++-----
 httemplate/edit/msgcat.html |    2 +-
 3 files changed, 20 insertions(+), 12 deletions(-)




More information about the freeside-commits mailing list