X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=httemplate%2Fmisc%2Fcancel-unaudited.cgi;h=f1fb1534156e3f1da17906fa42327dde3c1af457;hb=73233cfa60984978f1593bf86c248c0bab3620a5;hp=a73b2ce974dc27f1fbc4b407411be837eeca08ef;hpb=22a35047ecdffff80110e06cc08fc84f9ddba9b0;p=freeside.git diff --git a/httemplate/misc/cancel-unaudited.cgi b/httemplate/misc/cancel-unaudited.cgi index a73b2ce97..f1fb15341 100755 --- a/httemplate/misc/cancel-unaudited.cgi +++ b/httemplate/misc/cancel-unaudited.cgi @@ -7,15 +7,18 @@ my($query) = $cgi->keywords; $query =~ /^(\d+)$/; my $svcnum = $1; -my $svc_acct = qsearchs('svc_acct',{'svcnum'=>$svcnum}); -die "Unknown svcnum!" unless $svc_acct; +#my $svc_acct = qsearchs('svc_acct',{'svcnum'=>$svcnum}); +#die "Unknown svcnum!" unless $svc_acct; my $cust_svc = qsearchs('cust_svc',{'svcnum'=>$svcnum}); +die "Unknown svcnum!" unless $cust_svc; &eidiot(qq!This account has already been audited. Cancel the package instead.!) if $cust_svc->pkgnum ne '' && $cust_svc->pkgnum ne '0'; +my $svc_x = $cust_svc->svc_x; + local $SIG{HUP} = 'IGNORE'; local $SIG{INT} = 'IGNORE'; local $SIG{QUIT} = 'IGNORE'; @@ -24,21 +27,21 @@ local $SIG{TSTP} = 'IGNORE'; local $FS::UID::AutoCommit = 0; -my $error = $svc_acct->cancel; -&myeidiot($error) if $error; -$error = $svc_acct->delete; -&myeidiot($error) if $error; - -$error = $cust_svc->delete; -&myeidiot($error) if $error; +my $error = $svc_x->cancel; +$error ||= $svc_x->delete; +$error ||= $cust_svc->delete; -$dbh->commit or die $dbh->errstr; +if ( $error ) { + $dbh->rollback; + %> + +<% + &eidiot($error); +} else { -print $cgi->redirect(popurl(2)); + $dbh->commit or die $dbh->errstr; -sub myeidiot { - $dbh->rollback; - &eidiot(@_); + print $cgi->redirect(popurl(2)); } %>