X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=FS%2FFS%2Fpart_pkg%2Fvoip_cdr.pm;h=6a3a2acc2428cdb8e88a9aee7caace1464d3c8c3;hp=0f25e15d4bb83c54a054eef80035845566765c14;hb=988ec48fea05902eb7ea22e43a44e86a36eee06a;hpb=3b35ccbf226efe00c94f3a72dd1c7ed64d926a7c diff --git a/FS/FS/part_pkg/voip_cdr.pm b/FS/FS/part_pkg/voip_cdr.pm index 0f25e15d4..6a3a2acc2 100644 --- a/FS/FS/part_pkg/voip_cdr.pm +++ b/FS/FS/part_pkg/voip_cdr.pm @@ -7,6 +7,7 @@ use Tie::IxHash; use FS::Conf; use FS::Record qw(qsearchs qsearch); use FS::part_pkg::flat; +use FS::cdr; #use FS::rate; #use FS::rate_prefix; @@ -79,6 +80,11 @@ tie my %rating_method, 'Tie::IxHash', 'type' => 'checkbox', }, + 'output_format' => { 'name' => 'Simple output format', + 'type' => 'select', + 'select_options' => { FS::cdr::invoice_formats() }, + }, + #XXX also have option for an external db # 'cdr_location' => { 'name' => 'CDR database location' # 'type' => 'select', @@ -109,7 +115,7 @@ tie my %rating_method, 'Tie::IxHash', default_prefix disable_src domestic_prefix international_prefix - use_amaflags use_disposition + use_amaflags use_disposition output_format ) ], 'weight' => 40, @@ -136,6 +142,9 @@ sub calc_recur { my $downstream_cdr = ''; + my $output_format = $self->option('output_format', 'Hush!') + || 'voxlinesystems'; + foreach my $cust_svc ( grep { $_->part_svc->svcdb eq 'svc_phone' } $cust_pkg->cust_svc ) { @@ -292,7 +301,7 @@ sub calc_recur { $charge = sprintf('%.3f', $cdr->upstream_price); $charges += $charge; - @call_details = ( $cdr->downstream_csv( 'format' => 'voxlinesystems' )); + @call_details = ($cdr->downstream_csv( 'format' => $output_format )); } else { die "don't know how to rate CDRs using method: ". @@ -362,7 +371,10 @@ sub calc_recur { $call_details = join(' - ', @call_details ); } warn " adding details on charge to invoice: $call_details" - if $DEBUG; + if ( $DEBUG && !ref($call_details) ); + warn " adding details on charge to invoice: [ ". + join(', ', @{$call_details} ). " ]" + if ( $DEBUG && ref($call_details) ); push @$details, $call_details; #\@call_details, } @@ -379,7 +391,7 @@ sub calc_recur { } # $cdr - unshift @$details, [ 'C', "Date,Time,Name,Destination,Duration,Price" ] + unshift @$details, [ 'C', FS::cdr::invoice_header( $output_format) ] if (@$details && $self->option('rating_method') eq 'upstream_simple' ); } # $cust_svc