X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=FS%2FFS%2FTemplateItem_Mixin.pm;h=28fbd591dffe113a14666d51e117d8e17c1a1c00;hp=248da3caed8cbc8d5b8ba969762f34fe1c4cf148;hb=6fbdc0d20421de8e0d93eb9d332a0683efb994cc;hpb=068d26f9e8a61358cf555d4d62ad17c0f6bacf2a 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} }