summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--FS/FS/cust_bill.pm3
-rw-r--r--FS/FS/pay_batch.pm2
-rw-r--r--httemplate/misc/download-batch.cgi2
3 files changed, 4 insertions, 3 deletions
diff --git a/FS/FS/cust_bill.pm b/FS/FS/cust_bill.pm
index c2a39afda..8a05fcf31 100644
--- a/FS/FS/cust_bill.pm
+++ b/FS/FS/cust_bill.pm
@@ -1286,10 +1286,11 @@ sub batch_card {
local $FS::UID::AutoCommit = 0;
my $dbh = dbh;
- my $pay_batch = qsearchs('pay_batch'=> '');
+ my $pay_batch = qsearchs('pay_batch', {'status' => 'O'});
unless ($pay_batch) {
$pay_batch = new FS::pay_batch;
+ $pay_batch->setfield('status' => 'O');
my $error = $pay_batch->insert;
if ( $error ) {
die "error creating new batch: $error\n";
diff --git a/FS/FS/pay_batch.pm b/FS/FS/pay_batch.pm
index 192c5df83..41b312c7a 100644
--- a/FS/FS/pay_batch.pm
+++ b/FS/FS/pay_batch.pm
@@ -98,7 +98,7 @@ sub check {
my $error =
$self->ut_numbern('batchnum')
- || $self->ut_enum('status', [ '', 'I', 'R' ])
+ || $self->ut_enum('status', [ 'O', 'I', 'R' ])
;
return $error if $error;
diff --git a/httemplate/misc/download-batch.cgi b/httemplate/misc/download-batch.cgi
index 2d6f8a286..6172b1335 100644
--- a/httemplate/misc/download-batch.cgi
+++ b/httemplate/misc/download-batch.cgi
@@ -16,7 +16,7 @@ my $oldAutoCommit = $FS::UID::AutoCommit;
local $FS::UID::AutoCommit = 0;
my $dbh = dbh;
-my $pay_batch = qsearchs('pay_batch', {'status'=>''} );
+my $pay_batch = qsearchs('pay_batch', {'status'=>'O'} );
die "No pending batch. \n" unless $pay_batch;
my %batchhash = $pay_batch->hash;