3 my $conf = new FS::Conf;
4 die "Customer deletions not enabled" unless $conf->exists('deletecustomers');
6 $cgi->param('custnum') =~ /^(\d+)$/;
9 if ( $cgi->param('new_custnum') ) {
10 $cgi->param('new_custnum') =~ /^(\d+)$/
11 or die "Illegal new customer number: ". $cgi->param('new_custnum');
16 my $cust_main = qsearchs( 'cust_main', { 'custnum' => $custnum } )
17 or die "Customer not found: $custnum";
19 my $error = $cust_main->delete($new_custnum);
22 $cgi->param('error', $error);
23 print $cgi->redirect(popurl(2). "delete-customer.cgi?". $cgi->query_string );
24 } elsif ( $new_custnum ) {
25 print $cgi->redirect(popurl(3). "view/cust_main.cgi?$new_custnum");
27 print $cgi->redirect(popurl(3));