X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=FS%2FFS%2Fpay_batch.pm;h=364e7f63ea52963d319d8892417d7e38537f35c1;hb=d7c1839c14f0d37a352388b8df4086c47bedc6e5;hp=2a048a115321e3c1c36a7738fb635e590e313d9a;hpb=f3e0ac2b009c4edd5692cb587ff709dac2223ebe;p=freeside.git diff --git a/FS/FS/pay_batch.pm b/FS/FS/pay_batch.pm index 2a048a115..364e7f63e 100644 --- a/FS/FS/pay_batch.pm +++ b/FS/FS/pay_batch.pm @@ -234,6 +234,36 @@ I - an L module I - an L object for a batch gateway. This takes precedence over I. +Supported format keys (defined in the specified FS::pay_batch module) are: + +I - required, can be CSV, fixed, variable, XML + +I - required list of field names for each row/line + +I - regular expression for fixed filetype + +I - required for variable filetype + +I - required for XML filetype + +I - required for XML filetype + +I - sub, ignore all lines before this returns true + +I - sub, stop processing lines when this returns true + +I - sub, runs immediately after end_condition returns true + +I - sub, skip lines when this returns true + +I - required, sub, runs before approved/declined conditions are checked + +I - required, sub, returns true when approved + +I - required, sub, returns true when declined + +I - sub, decide whether or not to close the batch + =cut sub import_results { @@ -544,7 +574,14 @@ sub import_from_gateway { my $processor = $gateway->batch_processor(%proc_opt); - my @batches = $processor->receive; + my @processor_ids = map { $_->processor_id } + qsearch({ + 'table' => 'pay_batch', + 'hashref' => { 'status' => 'I' }, + 'extra_sql' => q( AND processor_id != '' AND processor_id IS NOT NULL) + }); + + my @batches = $processor->receive(@processor_ids); my $num = 0; @@ -764,7 +801,7 @@ sub import_from_gateway { my $body = "Import from gateway ".$gateway->label."\n".$error_text; send_email( to => $mail_on_error, - from => $conf->config('invoice_from'), + from => $conf->invoice_from_full(), subject => $subject, body => $body, ); @@ -946,7 +983,7 @@ sub export_batch { my $info = $export_info{$format} or die "Format not found: '$format'\n"; - &{$info->{'init'}}($conf) if exists($info->{'init'}); + &{$info->{'init'}}($conf, $self->agentnum) if exists($info->{'init'}); my $oldAutoCommit = $FS::UID::AutoCommit; local $FS::UID::AutoCommit = 0; @@ -1029,6 +1066,11 @@ sub export_to_gateway { ); $processor->submit($batch); + if ($batch->processor_id) { + $self->set('processor_id',$batch->processor_id); + $self->replace; + } + $dbh->commit or die $dbh->errstr if $oldAutoCommit; ''; }