X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=FS%2FFS%2Fcust_pay.pm;fp=FS%2FFS%2Fcust_pay.pm;h=86e7968a2cb416523e80163a21990f3aa7d88a79;hp=620f6c6296762b710012c0145f6c579f725c0813;hb=b3cc20aeca25e4351c6ec3b795a951e6124f6376;hpb=2ffdb485e5534df3d89bcc12d4d02d485e9b28f5 diff --git a/FS/FS/cust_pay.pm b/FS/FS/cust_pay.pm index 620f6c629..86e7968a2 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 {