2 % $cgi->param('error', $error);
3 <% $cgi->redirect(popurl(2). "delete-customer.cgi?". $cgi->query_string ) %>
4 %} elsif ( $new_custnum ) {
5 <% $cgi->redirect(popurl(3). "view/cust_main.cgi?$new_custnum") %>
7 <% $cgi->redirect(popurl(3)) %>
11 my $conf = new FS::Conf;
12 die "Customer deletions not enabled in configuration"
13 unless $conf->exists('deletecustomers');
16 unless $FS::CurrentUser::CurrentUser->access_right('Delete customer');
18 $cgi->param('custnum') =~ /^(\d+)$/;
21 if ( $cgi->param('new_custnum') ) {
22 $cgi->param('new_custnum') =~ /^(\d+)$/
23 or die "Illegal new customer number: ". $cgi->param('new_custnum');
28 my $cust_main = qsearchs( 'cust_main', { 'custnum' => $custnum } )
29 or die "Customer not found: $custnum";
31 my $error = $cust_main->delete('new_custnum' => $new_custnum);