X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=FS%2FFS%2Fcust_bill.pm;h=0ba6cdfed7be6cd5a9e3e85f88279affa259c335;hb=83053569b3d965924e2e1d4f5b199609ec7c29af;hp=3f94796c6e73b5e16e54ac08aba8d42b1d379d4b;hpb=2705b64bb669ba94492a185410e8d67f6ea82edd;p=freeside.git diff --git a/FS/FS/cust_bill.pm b/FS/FS/cust_bill.pm index 3f94796c6..0ba6cdfed 100644 --- a/FS/FS/cust_bill.pm +++ b/FS/FS/cust_bill.pm @@ -2832,8 +2832,10 @@ sub print_generic { if ($conf->exists('voip-cust_accountcode_cdr') && $cust_main->accountcode_cdr) { my ($accountcode_section, $accountcode_lines) = $self->_items_accountcode_cdr($escape_function_nonbsp,$format); - push @{$late_sections}, $accountcode_section; - push @detail_items, @$accountcode_lines; + if ( scalar(@$accountcode_lines) ) { + push @{$late_sections}, $accountcode_section; + push @detail_items, @$accountcode_lines; + } } }else{ push @sections, { 'description' => '', 'subtotal' => '' }; @@ -4149,7 +4151,6 @@ sub _items_accountcode_cdr { 'description' => 'Usage by Account Code', 'post_total' => '', 'summarized' => '', - 'total_generator' => sub { '' }, 'header' => '', }; my @lines; @@ -4186,6 +4187,7 @@ sub _items_accountcode_cdr { ext_description => [], }; + $section->{'amount'} += $amount; $accountcodes{$accountcode}{'amount'} += $amount; $accountcodes{$accountcode}{calls}++; $accountcodes{$accountcode}{duration} += $detail->duration; @@ -4200,7 +4202,9 @@ sub _items_accountcode_cdr { push @lines, $l; } - return ($section,\@lines); + my @sorted_lines = sort { $a->{'description'} <=> $b->{'description'} } @lines; + + return ($section,\@sorted_lines); } sub _items_svc_phone_sections {