summaryrefslogtreecommitdiff
path: root/FS
diff options
context:
space:
mode:
authorivan <ivan>2009-01-06 21:16:18 +0000
committerivan <ivan>2009-01-06 21:16:18 +0000
commit1e6dd07a7ded1948587ece00aa1f1c467e55af20 (patch)
tree3b39296b381de721903ba407f3a04dea2db1d879 /FS
parent0a78989c9f9e1d447c7e854a856820f5b9e05d06 (diff)
swap price to last column in default CDR output format; fix "all 0 prices" when using simple output format w/internal rating, RT#4503
Diffstat (limited to 'FS')
-rw-r--r--FS/FS/cdr.pm28
-rw-r--r--FS/FS/part_pkg/voip_cdr.pm5
2 files changed, 17 insertions, 16 deletions
diff --git a/FS/FS/cdr.pm b/FS/FS/cdr.pm
index 3c806f4c5..dc94bcf62 100644
--- a/FS/FS/cdr.pm
+++ b/FS/FS/cdr.pm
@@ -436,11 +436,11 @@ my %export_names = (
},
'default' => {
'name' => 'Default',
- 'invoice_header' => 'Date,Time,Duration,Price,Number,Destination',
+ 'invoice_header' => 'Date,Time,Number,Destination,Duration,Price',
},
'source_default' => {
'name' => 'Default with source',
- 'invoice_header' => 'Caller,Date,Time,Duration,Number,Destination,Price',
+ 'invoice_header' => 'Caller,Date,Time,Number,Destination,Duration,Price',
},
);
@@ -466,7 +466,8 @@ my %export_formats = (
'userfield', #USER
'dst', #NUMBER_DIALED
sub { sprintf('%.2fm', shift->billsec / 60 ) }, #DURATION
- sub { sprintf('%.3f', shift->upstream_price ) }, #PRICE
+ #sub { sprintf('%.3f', shift->upstream_price ) }, #PRICE
+ sub { my($cdr, %opt) = @_; $opt{money_char}. $opt{charge}; }, #PRICE
],
'simple2' => [
sub { time2str('%D', shift->calldate_unix ) }, #DATE
@@ -475,7 +476,8 @@ my %export_formats = (
'dst', #NUMBER_DIALED
'src', #called from
sub { sprintf('%.2fm', shift->billsec / 60 ) }, #DURATION
- sub { sprintf('%.3f', shift->upstream_price ) }, #PRICE
+ #sub { sprintf('%.3f', shift->upstream_price ) }, #PRICE
+ sub { my($cdr, %opt) = @_; $opt{money_char}. $opt{charge}; }, #PRICE
],
'default' => [
@@ -487,6 +489,12 @@ my %export_formats = (
sub { time2str('%r', shift->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
+ #DEST ("Number")
+ sub { my($cdr, %opt) = @_; $opt{pretty_dst} || $cdr->dst; },
+
+ #REGIONNAME ("Destination")
+ sub { my($cdr, %opt) = @_; $opt{dst_regionname}; },
+
#DURATION
sub { my($cdr, %opt) = @_;
$opt{minutes}. ( $opt{granularity} ? 'm' : ' call' );
@@ -495,19 +503,9 @@ my %export_formats = (
#PRICE
sub { my($cdr, %opt) = @_; $opt{money_char}. $opt{charge}; },
- #DEST ("Number")
- sub { my($cdr, %opt) = @_; $opt{pretty_dst} || $cdr->dst; },
-
- #REGIONNAME ("Destination")
- sub { my($cdr, %opt) = @_; $opt{dst_regionname}; },
-
],
);
-$export_formats{'source_default'} = [ 'src',
- @{ $export_formats{'default'} }[0..2],
- @{ $export_formats{'default'} }[4..5],
- @{ $export_formats{'default'} }[3],
- ];
+$export_formats{'source_default'} = [ 'src', @{ $export_formats{'default'} }, ];
sub downstream_csv {
my( $self, %opt ) = @_;
diff --git a/FS/FS/part_pkg/voip_cdr.pm b/FS/FS/part_pkg/voip_cdr.pm
index 4f41764b7..09789d945 100644
--- a/FS/FS/part_pkg/voip_cdr.pm
+++ b/FS/FS/part_pkg/voip_cdr.pm
@@ -381,7 +381,10 @@ sub calc_recur {
$charge = sprintf('%.3f', $cdr->upstream_price);
$charges += $charge;
- @call_details = ($cdr->downstream_csv( 'format' => $output_format ));
+ @call_details = ($cdr->downstream_csv( 'format' => $output_format,
+ 'charge' => $charge,
+ )
+ );
$classnum = $cdr->calltypenum;
} else {