cache foo
[freeside.git] / httemplate / misc / delete-customer.cgi
1 <%
2 #<!-- $Id: delete-customer.cgi,v 1.4 2001-10-26 10:24:56 ivan Exp $ -->
3
4 use strict;
5 use vars qw( $cgi $conf $query $custnum $new_custnum $cust_main );
6 use CGI;
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);
11 use FS::cust_main;
12
13 $cgi = new CGI;
14 cgisuidsetup($cgi);
15
16 $conf = new FS::Conf;
17 die "Customer deletions not enabled" unless $conf->exists('deletecustomers');
18
19 if ( $cgi->param('error') ) {
20   $custnum = $cgi->param('custnum');
21   $new_custnum = $cgi->param('new_custnum');
22 } else {
23   ($query) = $cgi->keywords;
24   $query =~ /^(\d+)$/ or die "Illegal query: $query";
25   $custnum = $1;
26   $new_custnum = '';
27 }
28 $cust_main = qsearchs( 'cust_main', { 'custnum' => $custnum } )
29   or die "Customer not found: $custnum";
30
31 print $cgi->header ( @FS::CGI::header ), header('Delete customer');
32
33 print qq!<FONT SIZE="+1" COLOR="#ff0000">Error: !, $cgi->param('error'),
34       "</FONT>"
35   if $cgi->param('error');
36
37 print 
38   qq!<form action="!, popurl(1), qq!process/delete-customer.cgi" method=post>!,
39   qq!<input type="hidden" name="custnum" value="$custnum">!;
40
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>!;
44 }
45
46 print <<END;
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)
51 <br>
52 <br>Are you <b>absolutely sure</b> you want to delete this customer?
53 <br><input type="submit" value="Yes">
54 </form></body></html>
55 END
56
57 %>