diff options
author | levinse <levinse> | 2011-01-14 20:08:18 +0000 |
---|---|---|
committer | levinse <levinse> | 2011-01-14 20:08:18 +0000 |
commit | d1420306b8a28c06169e9d8f91070670311cccf3 (patch) | |
tree | 6226398320f0c728b1ab00bdfbae4fa99b81a697 /FS | |
parent | e8000c840fecc04306b93898d5bffc176542722d (diff) |
make CDR invoice details appear chronologically on invoices, for voip_cdr, RT10960
Diffstat (limited to 'FS')
-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 5dbd115ad..3996b8b84 100644 --- a/FS/FS/part_pkg/voip_cdr.pm +++ b/FS/FS/part_pkg/voip_cdr.pm @@ -385,6 +385,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 ) ) { @@ -743,7 +745,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 @@ -761,6 +763,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 |