RT# 82988 - V3 fix
authorChristopher Burger <burgerc@freeside.biz>
Wed, 13 Mar 2019 13:21:11 +0000 (09:21 -0400)
committerChristopher Burger <burgerc@freeside.biz>
Wed, 13 Mar 2019 13:21:11 +0000 (09:21 -0400)
FS/FS/cust_main.pm

index ff75eb6..03300a0 100644 (file)
@@ -2775,6 +2775,10 @@ sub batch_card {
                               );
   }
 
                               );
   }
 
+  my $paycode = $options{paycode} || '';
+  my $batch_type = "DEBIT";
+  $batch_type = "CREDIT" if $paycode eq 'C';
+
   my $oldAutoCommit = $FS::UID::AutoCommit;
   local $FS::UID::AutoCommit = 0;
   my $dbh = dbh;
   my $oldAutoCommit = $FS::UID::AutoCommit;
   local $FS::UID::AutoCommit = 0;
   my $dbh = dbh;
@@ -2787,6 +2791,7 @@ sub batch_card {
   my %pay_batch = (
     'status' => 'O',
     'payby'  => FS::payby->payby2payment($payby),
   my %pay_batch = (
     'status' => 'O',
     'payby'  => FS::payby->payby2payment($payby),
+    'type' => $batch_type,
   );
   $pay_batch{agentnum} = $self->agentnum if $conf->exists('batch-spoolagent');
 
   );
   $pay_batch{agentnum} = $self->agentnum if $conf->exists('batch-spoolagent');