X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=FS%2FFS%2Fcdr.pm;h=418519eb2e5f1ce4dfcb8a33e7a2be6a2263a5e0;hb=5849811bcc0f85c9c92d89f3948c5779dd67998d;hp=421fd2bb8e5cd95f5312d4cfaef0f657782b96ae;hpb=deba223d89f516851d24d535d785cc2b39b7784c;p=freeside.git diff --git a/FS/FS/cdr.pm b/FS/FS/cdr.pm index 421fd2bb8..418519eb2 100644 --- a/FS/FS/cdr.pm +++ b/FS/FS/cdr.pm @@ -153,6 +153,54 @@ points to. You can ask the object for a copy with the I method. sub table { 'cdr'; } +sub table_info { + { + 'fields' => { +#XXX fill in some (more) nice names + #'acctid' => '', + 'calldate' => 'Call date', + 'clid' => 'Caller ID', + 'src' => 'Source', + 'dst' => 'Destination', + 'dcontext' => 'Dest. context', + 'channel' => 'Channel', + 'dstchannel' => 'Destination channel', + #'lastapp' => '', + #'lastdata' => '', + 'startdate' => 'Start date', + 'answerdate' => 'Answer date', + 'enddate' => 'End date', + 'duration' => 'Duration', + 'billsec' => 'Billable seconds', + 'disposition' => 'Disposition', + 'amaflags' => 'AMA flags', + 'accountcode' => 'Account code', + #'uniqueid' => '', + 'userfield' => 'User field', + #'cdrtypenum' => '', + 'charged_party' => 'Charged party', + #'upstream_currency' => '', + 'upstream_price' => 'Upstream price', + #'upstream_rateplanid' => '', + #'ratedetailnum' => '', + 'rated_price' => 'Rated price', + #'distance' => '', + #'islocal' => '', + #'calltypenum' => '', + #'description' => '', + #'quantity' => '', + 'carrierid' => 'Carrier ID', + #'upstream_rateid' => '', + 'svcnum' => 'Freeside service', + 'freesidestatus' => 'Freeside status', + 'freesiderewritestatus' => 'Freeside rewrite status', + 'cdrbatch' => 'Batch', + }, + + }; + +} + =item insert Adds this record to the database. If there is an error, returns the error, @@ -527,8 +575,8 @@ my %export_formats = ( sub { time2str('%D', shift->calldate_unix ) }, #DATE sub { time2str('%r', shift->calldate_unix ) }, #TIME #'userfield', #USER - 'dst', #NUMBER_DIALED 'src', #called from + 'dst', #NUMBER_DIALED $duration_sub, #DURATION #sub { sprintf('%.3f', shift->upstream_price ) }, #PRICE sub { my($cdr, %opt) = @_; $opt{money_char}. $opt{charge}; }, #PRICE @@ -710,7 +758,7 @@ sub _cdr_date_parse { #$date =~ /^\s*(\d{4})[\-\/]\(\d{1,2})[\-\/](\d{1,2})\s+(\d{1,2}):(\d{1,2}):(\d{1,2})\s*$/ #taqua #2007-10-31 08:57:24.113000000 - if ( $date =~ /^\s*(\d{4})\D(\d{1,2})\D(\d{1,2})\s+(\d{1,2})\D(\d{1,2})\D(\d{1,2})(\D|$)/ ) { + if ( $date =~ /^\s*(\d{4})\D(\d{1,2})\D(\d{1,2})\D+(\d{1,2})\D(\d{1,2})\D(\d{1,2})(\D|$)/ ) { ($year, $mon, $day, $hour, $min, $sec) = ( $1, $2, $3, $4, $5, $6 ); } elsif ( $date =~ /^\s*(\d{1,2})\D(\d{1,2})\D(\d{4})\s+(\d{1,2})\D(\d{1,2})\D(\d{1,2})(\D|$)/ ) { ($mon, $day, $year, $hour, $min, $sec) = ( $1, $2, $3, $4, $5, $6 ); @@ -718,8 +766,8 @@ sub _cdr_date_parse { die "unparsable date: $date"; #maybe we shouldn't die... } - return '' if $year == 1900 && $mon == 1 && $day == 1 - && $hour == 0 && $min == 0 && $sec == 0; + return '' if ( $year == 1900 || $year == 1970 ) && $mon == 1 && $day == 1 + && $hour == 0 && $min == 0 && $sec == 0; if ($options{gmt}) { timegm($sec, $min, $hour, $day, $mon-1, $year);