projects
/
freeside.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
9102acb
)
fix warning replacing pay_batch, RT#5650
author
ivan
<ivan>
Tue, 3 Nov 2009 20:44:05 +0000
(20:44 +0000)
committer
ivan
<ivan>
Tue, 3 Nov 2009 20:44:05 +0000
(20:44 +0000)
FS/FS/pay_batch.pm
patch
|
blob
|
history
diff --git
a/FS/FS/pay_batch.pm
b/FS/FS/pay_batch.pm
index
e0531f4
..
c1262e0
100644
(file)
--- a/
FS/FS/pay_batch.pm
+++ b/
FS/FS/pay_batch.pm
@@
-393,8
+393,8
@@
sub import_results {
}
}
-sub export_batch {
# Formerly httemplate/misc/download-batch.cgi
# Formerly httemplate/misc/download-batch.cgi
+sub export_batch {
my $self = shift;
my $conf = new FS::Conf;
my $format = shift || $conf->config('batch-default_format')
my $self = shift;
my $conf = new FS::Conf;
my $format = shift || $conf->config('batch-default_format')
@@
-402,26
+402,23
@@
sub export_batch {
my $info = $export_info{$format} or die "Format not found: '$format'\n";
&{$info->{'init'}}($conf) if exists($info->{'init'});
my $info = $export_info{$format} or die "Format not found: '$format'\n";
&{$info->{'init'}}($conf) if exists($info->{'init'});
+ my $curuser = $FS::CurrentUser::CurrentUser;
+
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;
- my $error;
-
my $first_download;
my $first_download;
- if($self->status eq 'O') {
+ my $status = $self->status;
+ if ($status eq 'O') {
$first_download = 1;
$first_download = 1;
- }
- elsif($self->status eq 'I' and
-
$FS::CurrentUser::CurrentU
ser->access_right('Reprocess batches')) {
+ my $error = $self->set_status('I');
+ die "error updating pay_batch status: $error\n" if $error;
+
} elsif ($status eq 'I' && $curu
ser->access_right('Reprocess batches')) {
$first_download = 0;
$first_download = 0;
+ } else {
+ die "No pending batch.\n";
}
}
- else {
- die "No pending batch.\n"
- }
-
- $error = $self->set_status('I');
- die "error updating pay_batch status: $error\n" if $error;
my $batch = '';
my $batchtotal = 0;
my $batch = '';
my $batchtotal = 0;
@@
-440,7
+437,7
@@
sub export_batch {
foreach my $cust_pay_batch (@cust_pay_batch) {
if($first_download) {
my $balance = $cust_pay_batch->cust_main->balance;
foreach my $cust_pay_batch (@cust_pay_batch) {
if($first_download) {
my $balance = $cust_pay_batch->cust_main->balance;
- $error = '';
+
my
$error = '';
if($balance <= 0) { # then don't charge this customer
$error = $cust_pay_batch->delete;
undef $cust_pay_batch;
if($balance <= 0) { # then don't charge this customer
$error = $cust_pay_batch->delete;
undef $cust_pay_batch;
@@
-470,7
+467,7
@@
sub export_batch {
}
if ($info->{'autopost'}) {
}
if ($info->{'autopost'}) {
- $error = &{$info->{'autopost'}}($self, $batch);
+
my
$error = &{$info->{'autopost'}}($self, $batch);
if($error) {
$dbh->rollback or die $dbh->errstr if $oldAutoCommit;
die $error;
if($error) {
$dbh->rollback or die $dbh->errstr if $oldAutoCommit;
die $error;