2 #<!-- $Id: delete-customer.cgi,v 1.3 2001-08-21 02:31:56 ivan Exp $ -->
5 use vars qw( $cgi $conf $query $custnum $new_custnum $cust_main );
7 use CGI::Carp qw(fatalsToBrowser);
8 use FS::UID qw(cgisuidsetup);
9 use FS::CGI qw(header popurl);
10 use FS::Record qw(qsearch qsearchs);
17 die "Customer deletions not enabled" unless $conf->exists('deletecustomers');
19 if ( $cgi->param('error') ) {
20 $custnum = $cgi->param('custnum');
21 $new_custnum = $cgi->param('new_custnum');
23 ($query) = $cgi->keywords;
24 $query =~ /^(\d+)$/ or die "Illegal query: $query";
28 $cust_main = qsearchs( 'cust_main', { 'custnum' => $custnum } )
29 or die "Customer not found: $custnum";
31 print $cgi->header ( '-expires' => 'now' ), header('Delete customer');
33 print qq!<FONT SIZE="+1" COLOR="#ff0000">Error: !, $cgi->param('error'),
35 if $cgi->param('error');
38 qq!<form action="!, popurl(1), qq!process/delete-customer.cgi" method=post>!,
39 qq!<input type="hidden" name="custnum" value="$custnum">!;
41 if ( qsearch('cust_pkg', { 'custnum' => $custnum, 'cancel' => '' } ) ) {
42 print "Move uncancelled packages to customer number ",
43 qq!<input type="text" name="new_custnum" value="$new_custnum"><br><br>!;
47 This will <b>completely remove</b> all traces of this customer record. This
48 is <B>not</B> what you want if this is a real customer who has simply
49 canceled service with you. For that, cancel all of the customer's packages.
50 (you can optionally hide cancelled customers with the <a href="../docs/config.html#hidecancelledcustomers">hidecancelledcustomers</a> configuration file)
52 <br>Are you <b>absolutely sure</b> you want to delete this customer?
53 <br><input type="submit" value="Yes">