summaryrefslogtreecommitdiff
path: root/FS
diff options
context:
space:
mode:
Diffstat (limited to 'FS')
-rw-r--r--FS/FS/Conf.pm2
-rw-r--r--FS/FS/cdr/cx3.pm45
-rw-r--r--FS/FS/pay_batch/eft_canada.pm9
3 files changed, 26 insertions, 30 deletions
diff --git a/FS/FS/Conf.pm b/FS/FS/Conf.pm
index c88d3e7a4..90b11a047 100644
--- a/FS/FS/Conf.pm
+++ b/FS/FS/Conf.pm
@@ -3855,7 +3855,7 @@ and customer address. Include units.',
{
'key' => 'batchconfig-eft_canada',
'section' => 'billing',
- 'description' => 'Configuration for EFT Canada batching, four lines: 1. SFTP username, 2. SFTP password, 3. Transaction code, 4. Number of days to delay process date. If you are using separate per-agent batches (batch-spoolagent), you must set this option separately for each agent, as the global setting will be ignored.',
+ 'description' => 'Configuration for EFT Canada batching, five lines: 1. SFTP username, 2. SFTP password, 3. Business transaction code, 4. Personal transaction code, 5. Number of days to delay process date. If you are using separate per-agent batches (batch-spoolagent), you must set this option separately for each agent, as the global setting will be ignored.',
'type' => 'textarea',
'per_agent' => 1,
},
diff --git a/FS/FS/cdr/cx3.pm b/FS/FS/cdr/cx3.pm
index 8c848078a..a1e2e93c4 100644
--- a/FS/FS/cdr/cx3.pm
+++ b/FS/FS/cdr/cx3.pm
@@ -10,40 +10,33 @@ use Date::Parse;
%info = (
'name' => '3CX',
'weight' => 120,
- 'header' => 1,
'import_fields' => [
-sub {
- my ($cdr, $data, $conf, $param) = @_;
- $param->{skiprow} = 1 unless $data =~ 'CallDetail'; # skip non-detail records
+ sub {
+ my ($cdr, $data, $conf, $param) = @_;
+ $param->{skiprow} = 1 unless $data =~ /Call\s/ ; # skip non-detail records
}, # record type
- skip(2), # unknown, callid ( not unique )
- 'src', # source
- 'dst', # destination
-sub { my ($cdr, $calldate, $param) = @_;
-
- if ($calldate =~ /^(\d{2})\/(\d{2})\/(\d{4})\s*(\d{2}):(\d{2}):(\d{2})$/){
+ skip(1), # unknown, callid ( not unique )
+ sub { my ($cdr, $duration) = @_;
+
+ my ($hour,$min,$sec) = split(/:/,$duration);
+ $sec = sprintf ("%.0f", $sec);
+ $sec += $min * 60;
+ $sec += $hour * 60 * 60;
+ $cdr->set('billsec', $sec);
+
+ }, # duration
+ skip(1),
+ sub { my ($cdr, $calldate, $param) = @_;
$cdr->set('calldate', $calldate);
- my $tmp_date = "$2/$1/$3 $4:$5:$6";
-
- $tmp_date = str2time($tmp_date);
- $cdr->set('startdate', $tmp_date);
- }
}, #date
-sub { my ($cdr, $duration) = @_;
-
- my ($hour,$min,$sec) = split(/:/,$duration);
- $sec += $min * 60;
- $sec += $hour * 60 * 60;
- $sec = sprintf ("%.0f", $sec);
- $cdr->set('billsec', $sec);
-
-}, #duration
- skip(1), # unknown
- 'disposition', # call status
+ skip(4),
'accountcode', # AccountCode
+ skip(6),
+ 'src', # source
+ 'dst', # destination
],
);
diff --git a/FS/FS/pay_batch/eft_canada.pm b/FS/FS/pay_batch/eft_canada.pm
index 0c093214a..ab9e6a3b6 100644
--- a/FS/FS/pay_batch/eft_canada.pm
+++ b/FS/FS/pay_batch/eft_canada.pm
@@ -15,7 +15,7 @@ $name = 'eft_canada';
%import_info = ( filetype => 'NONE' ); # see FS/bin/freeside-eftca-download
-my ($trans_code, $process_date);
+my ($business_trans_code, $personal_trans_code, $trans_code, $process_date);
#ref http://gocanada.about.com/od/canadatravelplanner/a/canada_holidays.htm
my %holiday_yearly = (
@@ -66,7 +66,8 @@ my %holiday = (
@config = $conf->config('batchconfig-eft_canada');
}
# SFTP login, password, trans code, delay time
- ($trans_code) = $config[2];
+ ($business_trans_code) = $config[2];
+ ($personal_trans_code) = $config[3];
$process_date = time2str('%D', process_date($conf, $agentnum));
},
@@ -82,12 +83,14 @@ my %holiday = (
my $company = sprintf('%.64s', $cust_pay_batch->cust_main->company);
if ( $company ) {
push @fields, 'Business';
- push @fields, $company, ''
+ push @fields, $company, '';
+ $trans_code = $business_trans_code;
}
else {
push @fields, 'Personal';
push @fields, map { sprintf('%.64s', $_) }
$cust_pay_batch->first, $cust_pay_batch->last;
+ $trans_code = $personal_trans_code;
}
my ($account, $aba) = split('@', $cust_pay_batch->payinfo);
my($bankno, $branch);