X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=FS%2FFS%2FTemplateItem_Mixin.pm;h=28ef845c9a89e91529a31f6f12cb39d385310ec7;hp=248da3caed8cbc8d5b8ba969762f34fe1c4cf148;hb=c6af881c09662e932da6d965887f5be27fbcc158;hpb=f32ac83068c6211f829f1688a1a9cdec71bc6ec7 diff --git a/FS/FS/TemplateItem_Mixin.pm b/FS/FS/TemplateItem_Mixin.pm index 248da3cae..28ef845c9 100644 --- a/FS/FS/TemplateItem_Mixin.pm +++ b/FS/FS/TemplateItem_Mixin.pm @@ -107,14 +107,13 @@ Returns a formatted time period for this line item. =cut sub time_period_pretty { - my( $self, $part_pkg, $agentnum ) = @_; + my( $self, $part_pkg, $agentnum, %opt ) = @_; #more efficient to look some of this conf stuff up outside the # invoice/template display loop we're called from # (Template_Mixin::_invoice_cust_bill_pkg) and pass them in as options - return '' if $conf->exists('disable_line_item_date_ranges') - || $part_pkg->option('disable_line_item_date_ranges',1) + return '' if $opt{'disable_line_item_date_ranges'} || ! $self->sdate || ! $self->edate; @@ -258,14 +257,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} }