diff options
author | Mark Wells <mark@freeside.biz> | 2016-06-27 16:39:23 -0700 |
---|---|---|
committer | Mark Wells <mark@freeside.biz> | 2016-06-27 16:39:23 -0700 |
commit | 6fbdc0d20421de8e0d93eb9d332a0683efb994cc (patch) | |
tree | 15ad78f2e5384da6f1e246ab2d0310b3ba688da2 /FS/FS/TemplateItem_Mixin.pm | |
parent | 068d26f9e8a61358cf555d4d62ad17c0f6bacf2a (diff) |
localize CDR column headings during rendering, #71331
Diffstat (limited to 'FS/FS/TemplateItem_Mixin.pm')
-rw-r--r-- | FS/FS/TemplateItem_Mixin.pm | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/FS/FS/TemplateItem_Mixin.pm b/FS/FS/TemplateItem_Mixin.pm index 248da3cae..28fbd591d 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} } |