[freeside-commits] freeside/FS/FS/part_pkg voip_cdr.pm,1.15,1.16
Jeff Finucane,420,,
jeff at wavetail.420.am
Wed Jun 4 10:59:09 PDT 2008
Update of /home/cvs/cvsroot/freeside/FS/FS/part_pkg
In directory wavetail.420.am:/tmp/cvs-serv24914/FS/FS/part_pkg
Modified Files:
voip_cdr.pm
Log Message:
voxline invoice formatting
Index: voip_cdr.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/part_pkg/voip_cdr.pm,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -d -r1.15 -r1.16
--- voip_cdr.pm 16 May 2008 19:26:38 -0000 1.15
+++ voip_cdr.pm 4 Jun 2008 17:59:06 -0000 1.16
@@ -7,6 +7,7 @@
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 @@
'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 @@
default_prefix
disable_src
domestic_prefix international_prefix
- use_amaflags use_disposition
+ use_amaflags use_disposition output_format
)
],
'weight' => 40,
@@ -136,6 +142,9 @@
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 @@
$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 @@
$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 @@
} # $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
More information about the freeside-commits
mailing list