summaryrefslogtreecommitdiff
path: root/FS
diff options
context:
space:
mode:
authorivan <ivan>2009-01-12 23:51:34 +0000
committerivan <ivan>2009-01-12 23:51:34 +0000
commitd130d157d6cf99c9936eef8844a03668e51dbca7 (patch)
treed5a3db0a39a3bf4d5faee62158187bc132025c3f /FS
parent0e63c90edae8b1e96e5cb0402246014c26045ee3 (diff)
taqua config to rewrite DA calls, RT#4502
Diffstat (limited to 'FS')
-rw-r--r--FS/FS/Conf.pm10
-rw-r--r--FS/FS/Record.pm10
-rw-r--r--FS/FS/cdr/taqua.pm25
3 files changed, 37 insertions, 8 deletions
diff --git a/FS/FS/Conf.pm b/FS/FS/Conf.pm
index 1e594e5b3..72fb98c0d 100644
--- a/FS/FS/Conf.pm
+++ b/FS/FS/Conf.pm
@@ -2014,14 +2014,14 @@ worry that config_items is freeside-specific and icky.
{
'key' => 'tax-ship_address',
'section' => 'billing',
- 'description' => 'By default, tax calculations are done based on the billing address. Enable this switch to calculate tax based on the shipping address instead. Note: Tax reports can take a long time when enabled.',
+ 'description' => 'By default, tax calculations are done based on the billing address. Enable this switch to calculate tax based on the shipping address instead.',
'type' => 'checkbox',
}
,
{
'key' => 'tax-pkg_address',
'section' => 'billing',
- 'description' => 'By default, tax calculations are done based on the billing address. Enable this switch to calculate tax based on the package address instead (when present). Note: Tax reports can take a long time when enabled.',
+ 'description' => 'By default, tax calculations are done based on the billing address. Enable this switch to calculate tax based on the package address instead (when present).',
'type' => 'checkbox',
},
@@ -2624,6 +2624,12 @@ worry that config_items is freeside-specific and icky.
'type' => 'checkbox',
},
+ {
+ 'key' => 'cdr-taqua-da_rewrite',
+ 'section' => '',
+ 'description' => 'For the Taqua CDR format, a comma-separated list of directory assistance 800 numbers. Any CDRs with these numbers as "BilledNumber" will be rewritten to the "CallingPartyNumber" (and CallType "12") on import.',
+ 'type' => 'text',
+ },
);
diff --git a/FS/FS/Record.pm b/FS/FS/Record.pm
index 16949fa95..b53c333ce 100644
--- a/FS/FS/Record.pm
+++ b/FS/FS/Record.pm
@@ -1365,14 +1365,16 @@ Formats hashref. Keys are field names, values are listrefs that define the
format.
Each listref value can be a column name or a code reference. Coderefs are run
-with the row object and data as the two parameters. For example, this coderef
-does the same thing as using the "columnname" string:
+with the row object, data and a FS::Conf object as the three parameters.
+For example, this coderef does the same thing as using the "columnname" string:
sub {
- my( $record, $data ) = @_;
+ my( $record, $data, $conf ) = @_;
$record->columnname( $data );
},
+Coderefs are run after all "column name" fields are assigned.
+
=item format_types
Optional format hashref of types. Keys are field names, values are "csv",
@@ -1662,7 +1664,7 @@ sub batch_import {
while ( scalar(@later) ) {
my $sub = shift @later;
my $data = shift @later;
- &{$sub}($record, $data); # $record->&{$sub}($data);
+ &{$sub}($record, $data, $conf); # $record->&{$sub}($data, $conf);
}
my $error = $record->insert;
diff --git a/FS/FS/cdr/taqua.pm b/FS/FS/cdr/taqua.pm
index fdbba8e95..3052f83e5 100644
--- a/FS/FS/cdr/taqua.pm
+++ b/FS/FS/cdr/taqua.pm
@@ -1,7 +1,7 @@
package FS::cdr::taqua;
use strict;
-use vars qw(@ISA %info);
+use vars qw(@ISA %info $da_rewrite);
use FS::cdr qw(_cdr_date_parser_maker);
@ISA = qw(FS::cdr);
@@ -60,7 +60,28 @@ use FS::cdr qw(_cdr_date_parser_maker);
sub { my($cdr, $field) = @_; }, #TermCircuit
sub { my($cdr, $field) = @_; }, #TermCircuitType
'carrierid', #OutboundCarrierId
- 'charged_party', #BillingNumber
+
+ #BillingNumber
+ #'charged_party',
+ sub {
+ my( $cdr, $field, $conf ) = @_;
+
+ #could be more efficient for the no config case, if anyone ever needs that
+ $da_rewrite ||= $conf->config('cdr-taqua-da_rewrite');
+
+ if ( $da_rewrite && $field =~ /\d/ ) {
+ my $rewrite = $da_rewrite;
+ $rewrite =~ s/\s//g;
+ my @rewrite = split(',', $conf->config('cdr-taqua-da_rewrite') );
+ if ( grep { $field eq $_ } @rewrite ) {
+ $cdr->charged_party( $cdr->src() );
+ $cdr->calltypenum(12);
+ return;
+ }
+ }
+ $cdr->charged_party($field);
+ },
+
sub { my($cdr, $field) = @_; }, #SubscriberNumber
'lastapp', #ServiceName
sub { my($cdr, $field) = @_; }, #some weirdness #ChargeTime