X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=httemplate%2Fmisc%2Fcancel-unaudited.cgi;h=43e439b58e0a62e345044f9ee4b404082c598db6;hp=a73b2ce974dc27f1fbc4b407411be837eeca08ef;hb=8ed2714fc50607081d7ac4edf0b17e23902dabba;hpb=22a35047ecdffff80110e06cc08fc84f9ddba9b0
diff --git a/httemplate/misc/cancel-unaudited.cgi b/httemplate/misc/cancel-unaudited.cgi
index a73b2ce97..43e439b58 100755
--- a/httemplate/misc/cancel-unaudited.cgi
+++ b/httemplate/misc/cancel-unaudited.cgi
@@ -7,38 +7,28 @@ 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});
-&eidiot(qq!This account has already been audited. Cancel the
- package instead.!)
- if $cust_svc->pkgnum ne '' && $cust_svc->pkgnum ne '0';
-
-local $SIG{HUP} = 'IGNORE';
-local $SIG{INT} = 'IGNORE';
-local $SIG{QUIT} = 'IGNORE';
-local $SIG{TERM} = 'IGNORE';
-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;
-
-$dbh->commit or die $dbh->errstr;
+die "Unknown svcnum!" unless $cust_svc;
+my $cust_pkg = $cust_svc->cust_pkg;
+if ( $cust_pkg ) {
+ &eidiot( 'This account has already been audited. Cancel the '.
+ qq!'.
+ 'package instead.');
+}
-print $cgi->redirect(popurl(2));
+my $error = $cust_svc->cancel;
-sub myeidiot {
- $dbh->rollback;
- &eidiot(@_);
+if ( $error ) {
+ %>
+
+<%
+ &eidiot($error);
+} else {
+ print $cgi->redirect(popurl(2));
}
%>