diff options
author | jeff <jeff> | 2007-11-27 02:52:33 +0000 |
---|---|---|
committer | jeff <jeff> | 2007-11-27 02:52:33 +0000 |
commit | a92b5e764aaccc7b46cef1a7147f8c71407ab759 (patch) | |
tree | 43b6ecf989cc57d65cb725b6ea95e0df9643b095 /FS | |
parent | 9f8e50c683598d9797e8babf4a21db4f6a65a1d8 (diff) |
prevent BILL, DCRD, and DCHK customers from circumventing a suspension via selfservice (2768)
Diffstat (limited to 'FS')
-rw-r--r-- | FS/FS/ClientAPI/MyAccount.pm | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/FS/FS/ClientAPI/MyAccount.pm b/FS/FS/ClientAPI/MyAccount.pm index b42a91e80..fef47e845 100644 --- a/FS/FS/ClientAPI/MyAccount.pm +++ b/FS/FS/ClientAPI/MyAccount.pm @@ -793,6 +793,7 @@ sub order_pkg { my $cust_main = qsearchs('cust_main', $search ) or return { 'error' => "unknown custnum $custnum" }; + my $status = $cust_main->status; #false laziness w/ClientAPI/Signup.pm my $cust_pkg = new FS::cust_pkg ( { @@ -864,7 +865,7 @@ sub order_pkg { my $conf = new FS::Conf; if ( $conf->exists('signup_server-realtime') ) { - my $bill_error = _do_bop_realtime( $cust_main ); + my $bill_error = _do_bop_realtime( $cust_main, $status ); if ($bill_error) { $cust_pkg->cancel('quiet'=>1); @@ -892,6 +893,7 @@ sub change_pkg { my $cust_main = qsearchs('cust_main', $search ) or return { 'error' => "unknown custnum $custnum" }; + my $status = $cust_main->status; my $cust_pkg = qsearchs('cust_pkg', { 'pkgnum' => $p->{pkgnum} } ) or return { 'error' => "unknown package $p->{pkgnum}" }; @@ -905,7 +907,7 @@ sub change_pkg { my $conf = new FS::Conf; if ( $conf->exists('signup_server-realtime') ) { - my $bill_error = _do_bop_realtime( $cust_main ); + my $bill_error = _do_bop_realtime( $cust_main, $status ); if ($bill_error) { $newpkg[0]->suspend; @@ -933,6 +935,7 @@ sub order_recharge { my $cust_main = qsearchs('cust_main', $search ) or return { 'error' => "unknown custnum $custnum" }; + my $status = $cust_main->status; my $cust_svc = qsearchs( 'cust_svc', { 'svcnum' => $p->{'svcnum'} } ) or return { 'error' => "unknown service " . $p->{'svcnum'} }; @@ -956,7 +959,7 @@ sub order_recharge { my $conf = new FS::Conf; if ( $conf->exists('signup_server-realtime') && !$bill_error ) { - $bill_error = _do_bop_realtime( $cust_main ); + $bill_error = _do_bop_realtime( $cust_main, $status ); if ($bill_error) { return $bill_error; @@ -976,7 +979,7 @@ sub order_recharge { } sub _do_bop_realtime { - my ($cust_main) = @_; + my ($cust_main, $status) = (shift, shift); my $old_balance = $cust_main->balance; @@ -986,7 +989,8 @@ sub _do_bop_realtime { if ( $cust_main->balance > $old_balance && $cust_main->balance > 0 - && $cust_main->payby !~ /^(BILL|DCRD|DCHK)$/ ) { + && ( $cust_main->payby !~ /^(BILL|DCRD|DCHK)$/ ? + 1 : $status eq 'suspended' ) ) { #this makes sense. credit is "un-doing" the invoice $cust_main->credit( sprintf("%.2f", $cust_main->balance - $old_balance ), 'self-service decline' ); |