better docs
[freeside.git] / httemplate / misc / delete-customer.cgi
1 <%
2 #
3 # $Id: delete-customer.cgi,v 1.2 2001-08-11 04:15:14 ivan Exp $
4 #
5 # $Log: delete-customer.cgi,v $
6 # Revision 1.2  2001-08-11 04:15:14  ivan
7 # better docs
8 #
9 # Revision 1.1  2001/07/30 07:36:04  ivan
10 # templates!!!
11 #
12 # Revision 1.1  1999/04/15 16:44:36  ivan
13 # delete customers
14 #
15
16 use strict;
17 use vars qw( $cgi $conf $query $custnum $new_custnum $cust_main );
18 use CGI;
19 use CGI::Carp qw(fatalsToBrowser);
20 use FS::UID qw(cgisuidsetup);
21 use FS::CGI qw(header popurl);
22 use FS::Record qw(qsearch qsearchs);
23 use FS::cust_main;
24
25 $cgi = new CGI;
26 cgisuidsetup($cgi);
27
28 $conf = new FS::Conf;
29 die "Customer deletions not enabled" unless $conf->exists('deletecustomers');
30
31 if ( $cgi->param('error') ) {
32   $custnum = $cgi->param('custnum');
33   $new_custnum = $cgi->param('new_custnum');
34 } else {
35   ($query) = $cgi->keywords;
36   $query =~ /^(\d+)$/ or die "Illegal query: $query";
37   $custnum = $1;
38   $new_custnum = '';
39 }
40 $cust_main = qsearchs( 'cust_main', { 'custnum' => $custnum } )
41   or die "Customer not found: $custnum";
42
43 print $cgi->header ( '-expires' => 'now' ), header('Delete customer');
44
45 print qq!<FONT SIZE="+1" COLOR="#ff0000">Error: !, $cgi->param('error'),
46       "</FONT>"
47   if $cgi->param('error');
48
49 print 
50   qq!<form action="!, popurl(1), qq!process/delete-customer.cgi" method=post>!,
51   qq!<input type="hidden" name="custnum" value="$custnum">!;
52
53 if ( qsearch('cust_pkg', { 'custnum' => $custnum, 'cancel' => '' } ) ) {
54   print "Move uncancelled packages to customer number ",
55         qq!<input type="text" name="new_custnum" value="$new_custnum"><br><br>!;
56 }
57
58 print <<END;
59 This will <b>completely remove</b> all traces of this customer record.  This
60 is <B>not</B> what you want if this is a real customer who has simply
61 canceled service with you.  For that, cancel all of the customer's packages.
62 (you can optionally hide cancelled customers with the <a href="../docs/config.html#hidecancelledcustomers">hidecancelledcustomers</a> configuration file)
63 <br>
64 <br>Are you <b>absolutely sure</b> you want to delete this customer?
65 <br><input type="submit" value="Yes">
66 </form></body></html>
67 END
68
69 %>