[freeside-commits] freeside/FS/FS/ClientAPI MyAccount.pm, 1.53.2.7, 1.53.2.8
Jeff Finucane,420,,
jeff at wavetail.420.am
Mon Nov 26 18:51:57 PST 2007
Update of /home/cvs/cvsroot/freeside/FS/FS/ClientAPI
In directory wavetail:/tmp/cvs-serv17551
Modified Files:
Tag: FREESIDE_1_7_BRANCH
MyAccount.pm
Log Message:
prevent BILL, DCRD, and DCHK customers from circumventing a suspension via selfservice (2768)
Index: MyAccount.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/ClientAPI/MyAccount.pm,v
retrieving revision 1.53.2.7
retrieving revision 1.53.2.8
diff -u -d -r1.53.2.7 -r1.53.2.8
--- MyAccount.pm 8 Nov 2007 04:21:34 -0000 1.53.2.7
+++ MyAccount.pm 27 Nov 2007 02:51:55 -0000 1.53.2.8
@@ -741,6 +741,7 @@
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 ( {
@@ -812,7 +813,7 @@
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);
@@ -840,6 +841,7 @@
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}" };
@@ -853,7 +855,7 @@
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;
@@ -881,6 +883,7 @@
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'} };
@@ -904,7 +907,7 @@
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;
@@ -924,7 +927,7 @@
}
sub _do_bop_realtime {
- my ($cust_main) = @_;
+ my ($cust_main, $status) = (shift, shift);
my $old_balance = $cust_main->balance;
@@ -935,7 +938,8 @@
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' );
More information about the freeside-commits
mailing list