diff options
author | levinse <levinse> | 2011-01-14 20:08:17 +0000 |
---|---|---|
committer | levinse <levinse> | 2011-01-14 20:08:17 +0000 |
commit | 51fa32c6d1d22d4b78afd4bf12e307fbdacc6062 (patch) | |
tree | bf8b83096f0e6a7b6816cda642760ab387687a27 | |
parent | b7a6c44ce03edfe635425cbd9f7a946a607131f7 (diff) |
make CDR invoice details appear chronologically on invoices, for voip_cdr, RT10960
-rw-r--r-- | FS/FS/part_pkg/voip_cdr.pm | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/FS/FS/part_pkg/voip_cdr.pm b/FS/FS/part_pkg/voip_cdr.pm index 8384c8c87..fea38c1d0 100644 --- a/FS/FS/part_pkg/voip_cdr.pm +++ b/FS/FS/part_pkg/voip_cdr.pm @@ -387,6 +387,8 @@ sub calc_usage { ); # $last_bill, $$sdate ) $options{'by_svcnum'} = 1 if $svc_field eq 'svcnum'; + my @invoice_details_sort; + foreach my $cdr ( $svc_x->get_cdrs( %options ) ) { @@ -748,7 +750,7 @@ sub calc_usage { warn " adding details on charge to invoice: [ ". join(', ', @{$call_details} ). " ]" if ( $DEBUG && ref($call_details) ); - push @$details, $call_details; #\@call_details, + push @invoice_details_sort, [ $call_details, $cdr->calldate_unix ]; } # if the customer flag is on, call "downstream_csv" or something @@ -766,6 +768,11 @@ sub calc_usage { } } # $cdr + + my @sorted_invoice_details = sort { @{$a}[1] <=> @{$b}[1] } @invoice_details_sort; + foreach my $sorted_call_detail ( @sorted_invoice_details ) { + push @$details, @{$sorted_call_detail}[0]; + } } # $cust_svc |