X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=FS%2FFS%2Fcdr.pm;h=adde898e43e7eb0bac3f42f5d70aa675bc768a2f;hb=988ec48fea05902eb7ea22e43a44e86a36eee06a;hp=29bbe0e99c95a9f2432553c2a9aae8fd81165a84;hpb=dc3217c61d6a62a8e599d8804e05ba45b3224c7e;p=freeside.git diff --git a/FS/FS/cdr.pm b/FS/FS/cdr.pm index 29bbe0e99..adde898e4 100644 --- a/FS/FS/cdr.pm +++ b/FS/FS/cdr.pm @@ -392,6 +392,18 @@ sub _convergent_format { =cut +my %export_names = ( + 'convergent' => {}, + 'voxlinesystems' => { 'name' => 'VoxLineSystems', + 'invoice_header' => + "Date,Time,Name,Destination,Duration,Price", + }, + 'voxlinesystems2' => { 'name' => 'VoxLineSystems with source', + 'invoice_header' => + "Date,Time,Name,Destination,Called From,Duration,Price", + }, +); + my %export_formats = ( 'convergent' => [ 'carriername', #CARRIER @@ -416,6 +428,15 @@ my %export_formats = ( sub { sprintf('%.2fm', shift->billsec / 60 ) }, #DURATION sub { sprintf('%.3f', shift->upstream_price ) }, #PRICE ], + 'voxlinesystems2' => [ + sub { time2str('%D', shift->calldate_unix ) }, #DATE + sub { time2str('%T', shift->calldate_unix ) }, #TIME + 'userfield', #USER + 'dst', #NUMBER_DIALED + 'src', #called from + sub { sprintf('%.2fm', shift->billsec / 60 ) }, #DURATION + sub { sprintf('%.3f', shift->upstream_price ) }, #PRICE + ], ); sub downstream_csv { @@ -448,6 +469,30 @@ sub downstream_csv { =over 4 +=item invoice_formats + +Returns an ordered list of key value pairs containing invoice format names +as keys (for use with part_pkg::voip_cdr) and "pretty" format names as values. + +=cut + +sub invoice_formats { + map { ($_ => $export_names{$_}->{'name'}) } + grep { $export_names{$_}->{'invoice_header'} } + keys %export_names; +} + +=item invoice_header FORMAT + +Returns a scalar containing the CSV column header for invoice format FORMAT. + +=cut + +sub invoice_header { + my $format = shift; + $export_names{$format}->{'invoice_header'}; +} + =item import_formats Returns an ordered list of key value pairs containing import format names