summaryrefslogtreecommitdiff
path: root/FS/FS/cust_pay.pm
diff options
context:
space:
mode:
authorJonathan Prykop <jonathan@freeside.biz>2016-03-14 23:39:18 -0500
committerJonathan Prykop <jonathan@freeside.biz>2016-03-17 00:31:29 -0500
commitfdff077d075af80c623bf03ce65cca4af0ebdde5 (patch)
tree8550b45ecb206bfadac1cc31da8bec5f07c6c0d5 /FS/FS/cust_pay.pm
parent216272ed8a5ccfc8dc72268b9b02cc8fcd4479cf (diff)
RT#28648: Unsuspend when past due balance is paid
Diffstat (limited to 'FS/FS/cust_pay.pm')
-rw-r--r--FS/FS/cust_pay.pm24
1 files changed, 12 insertions, 12 deletions
diff --git a/FS/FS/cust_pay.pm b/FS/FS/cust_pay.pm
index 620f6c6..86e7968 100644
--- a/FS/FS/cust_pay.pm
+++ b/FS/FS/cust_pay.pm
@@ -4,7 +4,7 @@ use strict;
use base qw( FS::otaker_Mixin FS::payinfo_transaction_Mixin FS::cust_main_Mixin
FS::reason_Mixin FS::Record);
use vars qw( $DEBUG $me $conf @encrypted_fields
- $unsuspendauto $ignore_noapply
+ $ignore_noapply
);
use Date::Format;
use Business::CreditCard;
@@ -36,7 +36,6 @@ $ignore_noapply = 0;
#ask FS::UID to run this stuff for us later
FS::UID->install_callback( sub {
$conf = new FS::Conf;
- $unsuspendauto = $conf->exists('unsuspendauto');
} );
@encrypted_fields = ('payinfo');
@@ -355,16 +354,8 @@ sub insert {
$dbh->commit or die $dbh->errstr if $oldAutoCommit;
- #false laziness w/ cust_credit::insert
- if ( $unsuspendauto && $old_balance && $cust_main->balance <= 0 ) {
- my @errors = $cust_main->unsuspend;
- #return
- # side-fx with nested transactions? upstack rolls back?
- warn "WARNING:Errors unsuspending customer ". $cust_main->custnum. ": ".
- join(' / ', @errors)
- if @errors;
- }
- #eslaf
+ # possibly trigger package unsuspend, doesn't abort transaction on failure
+ $self->unsuspend_balance if $old_balance;
#bill setup fees for voip_cdr bill_every_call packages
#some false laziness w/search in freeside-cdrd
@@ -1214,6 +1205,15 @@ sub _upgrade_data { #class method
process_upgrade_paybatch();
}
}
+
+ # unsuspendauto upgrade
+ # could just as easily go in cust_credit, or even cust_bill or cust_main
+ # but here works
+ if ($conf->exists('unsuspendauto') && !$conf->config('unsuspend_balance')) {
+ $conf->set('unsuspend_balance','Zero');
+ $conf->delete('unsuspendauto');
+ }
+
}
sub process_upgrade_paybatch {