hmm forgot to check this in?
[freeside.git] / httemplate / misc / delete-customer.cgi
1 <!-- mason kludge -->
2 <%
3
4 my $conf = new FS::Conf;
5 die "Customer deletions not enabled" unless $conf->exists('deletecustomers');
6
7 my($custnum, $new_custnum);
8 if ( $cgi->param('error') ) {
9   $custnum = $cgi->param('custnum');
10   $new_custnum = $cgi->param('new_custnum');
11 } else {
12   my($query) = $cgi->keywords;
13   $query =~ /^(\d+)$/ or die "Illegal query: $query";
14   $custnum = $1;
15   $new_custnum = '';
16 }
17 my $cust_main = qsearchs( 'cust_main', { 'custnum' => $custnum } )
18   or die "Customer not found: $custnum";
19
20 print header('Delete customer');
21
22 print qq!<FONT SIZE="+1" COLOR="#ff0000">Error: !, $cgi->param('error'),
23       "</FONT>"
24   if $cgi->param('error');
25
26 print 
27   qq!<form action="!, popurl(1), qq!process/delete-customer.cgi" method=post>!,
28   qq!<input type="hidden" name="custnum" value="$custnum">!;
29
30 if ( qsearch('cust_pkg', { 'custnum' => $custnum, 'cancel' => '' } ) ) {
31   print "Move uncancelled packages to customer number ",
32         qq!<input type="text" name="new_custnum" value="$new_custnum"><br><br>!;
33 }
34
35 print <<END;
36 This will <b>completely remove</b> all traces of this customer record.  This
37 is <B>not</B> what you want if this is a real customer who has simply
38 canceled service with you.  For that, cancel all of the customer's packages.
39 (you can optionally hide cancelled customers with the <a href="../config/config-view.cgi#hidecancelledcustomers">hidecancelledcustomers</a> configuration option)
40 <br>
41 <br>Are you <b>absolutely sure</b> you want to delete this customer?
42 <br><input type="submit" value="Yes">
43 </form></body></html>
44 END
45
46 #Deleting a customer you have financial records on (i.e. credits) is
47 #typically considered fraudulant bookkeeping.  Remember, deleting   
48 #customers should ONLY be used for completely bogus records.  You should
49 #NOT delete real customers who simply discontinue service.
50 #
51 #For real customers who simply discontinue service, cancel all of the
52 #customer's packages.  Customers with all cancelled packages are not  
53 #billed.  There is no need to take further action to prevent billing on
54 #customers with all cancelled packages.
55 #
56 #Also see the "hidecancelledcustomers" and "hidecancelledpackages"
57 #configuration options, which will allow you to surpress the display of
58 #cancelled customers and packages, respectively.
59
60 %>