{
'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',
},
'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',
+ },
);
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",
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;
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);
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