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