summaryrefslogtreecommitdiff
path: root/FS/FS
diff options
context:
space:
mode:
authorivan <ivan>2011-10-21 23:08:15 +0000
committerivan <ivan>2011-10-21 23:08:15 +0000
commit80e675c7305768010f8b08ef2ebdfb936432e84d (patch)
treeb4abb8da1f85844ad03f7c4430768d69048ea17e /FS/FS
parent9111b460e3bc7613294cf5da0aaad3a4b11d8dc0 (diff)
agent-virt batches and batchconfig-eftcanada config (argh!), RT#14859
Diffstat (limited to 'FS/FS')
-rw-r--r--FS/FS/Conf.pm8
-rw-r--r--FS/FS/Schema.pm14
-rw-r--r--FS/FS/cust_main.pm1
-rw-r--r--FS/FS/pay_batch.pm6
4 files changed, 21 insertions, 8 deletions
diff --git a/FS/FS/Conf.pm b/FS/FS/Conf.pm
index bee177052..590a5c3ec 100644
--- a/FS/FS/Conf.pm
+++ b/FS/FS/Conf.pm
@@ -3253,6 +3253,14 @@ and customer address. Include units.',
'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.',
'type' => 'textarea',
+ 'per_agent' => 1,
+ },
+
+ {
+ 'key' => 'batch-spoolagent',
+ 'section' => 'billing',
+ 'description' => 'Store payment batches per-agent.',
+ 'type' => 'checkbox',
},
{
diff --git a/FS/FS/Schema.pm b/FS/FS/Schema.pm
index 535999535..5c30a5e37 100644
--- a/FS/FS/Schema.pm
+++ b/FS/FS/Schema.pm
@@ -1382,19 +1382,19 @@ sub tables_hashref {
'pay_batch' => { #batches of payments to an external processor
'columns' => [
- 'batchnum', 'serial', '', '', '', '',
- 'payby', 'char', '', 4, '', '', # CARD/CHEK
- 'status', 'char', 'NULL', 1, '', '',
- 'download', @date_type, '', '',
- 'upload', @date_type, '', '',
+ 'batchnum', 'serial', '', '', '', '',
+ 'agentnum', 'int', 'NULL', '', '', '',
+ 'payby', 'char', '', 4, '', '', # CARD/CHEK
+ 'status', 'char', 'NULL', 1, '', '',
+ 'download', @date_type, '', '',
+ 'upload', @date_type, '', '',
],
'primary_key' => 'batchnum',
'unique' => [],
'index' => [],
},
- 'cust_pay_batch' => { #what's this used for again? list of customers
- #in current CARD batch? (necessarily CARD?)
+ 'cust_pay_batch' => { #list of customers in current CARD/CHEK batch
'columns' => [
'paybatchnum', 'serial', '', '', '', '',
'batchnum', 'int', '', '', '', '',
diff --git a/FS/FS/cust_main.pm b/FS/FS/cust_main.pm
index f96a45aef..0788e15de 100644
--- a/FS/FS/cust_main.pm
+++ b/FS/FS/cust_main.pm
@@ -2481,6 +2481,7 @@ sub batch_card {
'status' => 'O',
'payby' => FS::payby->payby2payment($payby),
);
+ $pay_batch{agentnum} = $self->agentnum if $conf->exists('batch-spoolagent');
my $pay_batch = qsearchs( 'pay_batch', \%pay_batch );
diff --git a/FS/FS/pay_batch.pm b/FS/FS/pay_batch.pm
index 90b4eb8eb..bde8fdbf7 100644
--- a/FS/FS/pay_batch.pm
+++ b/FS/FS/pay_batch.pm
@@ -5,8 +5,9 @@ use vars qw( @ISA $DEBUG %import_info %export_info $conf );
use Time::Local;
use Text::CSV_XS;
use FS::Record qw( dbh qsearch qsearchs );
-use FS::cust_pay;
use FS::Conf;
+use FS::cust_pay;
+use FS::agent;
use Date::Parse qw(str2time);
use Business::CreditCard qw(cardtype);
@@ -40,6 +41,8 @@ from FS::Record. The following fields are currently supported:
=item batchnum - primary key
+=item agentnum - optional agent number for agent batches
+
=item payby - CARD or CHEK
=item status - O (Open), I (In-transit), or R (Resolved)
@@ -112,6 +115,7 @@ sub check {
$self->ut_numbern('batchnum')
|| $self->ut_enum('payby', [ 'CARD', 'CHEK' ])
|| $self->ut_enum('status', [ 'O', 'I', 'R' ])
+ || $self->ut_foreign_keyn('agentnum', 'agent', 'agentnum')
;
return $error if $error;