X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=httemplate%2Fmisc%2Fcancel-unaudited.cgi;h=43e439b58e0a62e345044f9ee4b404082c598db6;hp=3e2bd07db0140d75c8016b7f9042cddcc6f97866;hb=8ed2714fc50607081d7ac4edf0b17e23902dabba;hpb=1fd6d8cf5d7854860ef4fd10ed89828e0c04ec39
diff --git a/httemplate/misc/cancel-unaudited.cgi b/httemplate/misc/cancel-unaudited.cgi
index 3e2bd07db..43e439b58 100755
--- a/httemplate/misc/cancel-unaudited.cgi
+++ b/httemplate/misc/cancel-unaudited.cgi
@@ -1,4 +1,4 @@
-
+<%
my $dbh = dbh;
@@ -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));
}
%>