[freeside-commits] freeside/FS/FS cdr.pm,1.53.2.2,1.53.2.3
Mark Wells
mark at wavetail.420.am
Tue May 4 15:26:08 PDT 2010
Update of /home/cvs/cvsroot/freeside/FS/FS
In directory wavetail.420.am:/tmp/cvs-serv18369
Modified Files:
Tag: FREESIDE_1_9_BRANCH
cdr.pm
Log Message:
RT#8026: WIP CDR format
Index: cdr.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/cdr.pm,v
retrieving revision 1.53.2.2
retrieving revision 1.53.2.3
diff -u -w -d -r1.53.2.2 -r1.53.2.3
--- cdr.pm 19 Nov 2009 09:47:15 -0000 1.53.2.2
+++ cdr.pm 4 May 2010 22:26:06 -0000 1.53.2.3
@@ -14,6 +14,7 @@
use FS::cdr_calltype;
use FS::cdr_carrier;
use FS::cdr_batch;
+use FS::cdr_termination;
@ISA = qw(FS::Record);
@EXPORT_OK = qw( _cdr_date_parser_maker _cdr_min_parser_maker );
@@ -386,11 +387,33 @@
=cut
sub set_status_and_rated_price {
- my($self, $status, $rated_price, $svcnum) = @_;
+ my($self, $status, $rated_price, $svcnum, %opt) = @_;
+ if($opt{'inbound'}) {
+ my $term = qsearchs('cdr_termination', {
+ acctid => $self->acctid,
+ termpart => 1 # inbound
+ });
+ my $error;
+ if($term) {
+ warn "replacing existing cdr status (".$self->acctid.")\n" if $term;
+ $error = $term->delete;
+ return $error if $error;
+ }
+ $term = FS::cdr_termination->new({
+ acctid => $self->acctid,
+ termpart => 1,
+ rated_price => $rated_price,
+ status => $status,
+ svcnum => $svcnum,
+ });
+ return $term->insert;
+ }
+ else {
$self->freesidestatus($status);
$self->rated_price($rated_price);
$self->svcnum($svcnum) if $svcnum;
- $self->replace();
+ return $self->replace();
+ }
}
=item calldate_unix
@@ -724,6 +747,9 @@
} elsif ( $date =~ /^\s*(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d+\.\d+)(\D|$)/ ) {
# broadsoft: 20081223201938.314
($year, $mon, $day, $hour, $min, $sec) = ( $1, $2, $3, $4, $5, $6);
+ } elsif ( $date =~ /^\s*(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})$/ ) {
+ # WIP: 20100329121420
+ ($year, $mon, $day, $hour, $min, $sec) = ( $1, $2, $3, $4, $5, $6 );
} else {
die "unparsable date: $date"; #maybe we shouldn't die...
}
More information about the freeside-commits
mailing list