summaryrefslogtreecommitdiff
path: root/FS/FS
diff options
context:
space:
mode:
authorjeff <jeff>2009-04-07 01:20:38 +0000
committerjeff <jeff>2009-04-07 01:20:38 +0000
commit1a588ca640701eac6e6f1c9dcd31fdc48d93fc9e (patch)
treef2cced372df7fd2b619d258eb34b3aa4c9cae8d0 /FS/FS
parentba06d25a6e19e6d5534e90619cf233306fa2f49c (diff)
correct taqua toll free handling and hasten cdr import (skip uninteresting records)
Diffstat (limited to 'FS/FS')
-rw-r--r--FS/FS/Record.pm5
-rw-r--r--FS/FS/cdr.pm13
-rw-r--r--FS/FS/cdr/taqua.pm10
-rw-r--r--FS/FS/part_pkg/voip_cdr.pm4
4 files changed, 25 insertions, 7 deletions
diff --git a/FS/FS/Record.pm b/FS/FS/Record.pm
index 7019cb9..1689845 100644
--- a/FS/FS/Record.pm
+++ b/FS/FS/Record.pm
@@ -1708,11 +1708,14 @@ sub batch_import {
my $record = $class->new( \%hash );
+ my $param = {};
while ( scalar(@later) ) {
my $sub = shift @later;
my $data = shift @later;
- &{$sub}($record, $data, $conf); # $record->&{$sub}($data, $conf);
+ &{$sub}($record, $data, $conf, $param); # $record->&{$sub}($data, $conf);
+ last if exists( $param->{skiprow} );
}
+ next if exists( $param->{skiprow} );
my $error = $record->insert;
diff --git a/FS/FS/cdr.pm b/FS/FS/cdr.pm
index 35bb71c..5f46739 100644
--- a/FS/FS/cdr.pm
+++ b/FS/FS/cdr.pm
@@ -269,6 +269,17 @@ sub check {
$self->SUPER::check;
}
+=item is_tollfree
+
+ Returns true when the cdr represents a toll free number and false otherwise.
+
+=cut
+
+sub is_tollfree {
+ my $self = shift;
+ ( $self->dst =~ /^(\+?1)?8(8|[02-7]{2})/ ) ? 1 : 0;
+}
+
=item set_charged_party
If the charged_party field is already set, does nothing. Otherwise:
@@ -294,7 +305,7 @@ sub set_charged_party {
} else {
- if ( $self->dst =~ /^(\+?1)?8[02-8]{2}/ ) {
+ if ( $self->is_tollfree ) {
$self->charged_party($self->dst);
} else {
$self->charged_party($self->src);
diff --git a/FS/FS/cdr/taqua.pm b/FS/FS/cdr/taqua.pm
index 5d6c694..44e2747 100644
--- a/FS/FS/cdr/taqua.pm
+++ b/FS/FS/cdr/taqua.pm
@@ -13,7 +13,13 @@ use FS::cdr qw(_cdr_date_parser_maker);
'import_fields' => [ #some of these are kind arbitrary...
#0
- 'cdrtypenum', #RecordType
+ #RecordType
+ sub {
+ my($cdr, $field, $conf, $hashref) = @_;
+ $hashref->{skiprow} = 1 unless ($field == 0 && $cdr->disposition == 100);
+ $cdr->cdrtypenum($field);
+ },
+
sub { my($cdr, $field) = @_; }, #all10#RecordVersion
sub { my($cdr, $field) = @_; }, #OrigShelfNumber
sub { my($cdr, $field) = @_; }, #OrigCardNumber
@@ -88,7 +94,7 @@ use FS::cdr qw(_cdr_date_parser_maker);
return;
}
}
- $cdr->charged_party($field);
+ '';
},
sub { my($cdr, $field) = @_; }, #SubscriberNumber
diff --git a/FS/FS/part_pkg/voip_cdr.pm b/FS/FS/part_pkg/voip_cdr.pm
index 9f6dd01..e25bba5 100644
--- a/FS/FS/part_pkg/voip_cdr.pm
+++ b/FS/FS/part_pkg/voip_cdr.pm
@@ -308,9 +308,7 @@ sub calc_recur {
###
my( $to_or_from, $number );
- if ( $cdr->dst =~ /^(\+?1)?8(8|[02-7]{2})/
- && ! $disable_tollfree
- )
+ if ( $cdr->is_tollfree && ! $disable_tollfree )
{ #tollfree call
$to_or_from = 'from';
$number = $cdr->src;