X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=FS%2FFS%2Fpart_pkg%2Fvoip_cdr.pm;h=a7c1903e6d9f93cb4dd379d4bc466be2fbc215b8;hp=a14db2b2c4c88fd3034dee676a5807da8bb7d180;hb=efc68f41987d007de5e792b88df1c63bf3dedf4c;hpb=6038f6fe5fe3590bcc8063f15ba8ce4cb6a985dc diff --git a/FS/FS/part_pkg/voip_cdr.pm b/FS/FS/part_pkg/voip_cdr.pm index a14db2b2c..a7c1903e6 100644 --- a/FS/FS/part_pkg/voip_cdr.pm +++ b/FS/FS/part_pkg/voip_cdr.pm @@ -158,6 +158,10 @@ sub calc_usage { my $output_format = $self->option('output_format', 'Hush!') || 'simple'; + eval "use Text::CSV_XS;"; + die $@ if $@; + my $csv = new Text::CSV_XS; + foreach my $cust_svc ( grep { $_->part_svc->svcdb eq 'svc_phone' } $cust_pkg->cust_svc ) { @@ -298,7 +302,7 @@ sub calc_usage { $charge = sprintf('%.2f', $cdr->upstream_price); $charges += $charge; - + @call_details = ( #time2str("%Y %b %d - %r", $cdr->calldate_unix ), time2str("%c", $cdr->calldate_unix), #XXX this should probably be a config option dropdown so they can select US vs- rest of world dates or whatnot @@ -383,10 +387,9 @@ sub calc_usage { if ( $self->option('rating_method') eq 'upstream_simple' ) { $call_details = [ 'C', $call_details[0] ]; }else{ - $call_details = join(' - ', @call_details ); + $csv->combine(@call_details); + $call_details = [ 'C', $csv->string ]; } - warn " adding details on charge to invoice: $call_details" - if ( $DEBUG && !ref($call_details) ); warn " adding details on charge to invoice: [ ". join(', ', @{$call_details} ). " ]" if ( $DEBUG && ref($call_details) ); @@ -476,7 +479,7 @@ sub append_cust_bill_pkgs { 'quantity' => $cust_pkg->quantity, 'sdate' => $$sdate, 'edate' => $cust_pkg->bill, # already fiddled - 'itemdesc' => 'Call details', # configurable? + 'itemdesc' => 'Usage charges', # configurable? 'details' => \@details, };