1 <% include('/elements/header.html', 'Delete customer') %>
3 <% include('/elements/error.html') %>
5 <FORM ACTION="<% popurl(1) %>process/delete-customer.cgi" METHOD=POST>
6 <INPUT TYPE="hidden" NAME="custnum" VALUE="<% $custnum |h %>">
8 %if ( qsearch('cust_pkg', { 'custnum' => $custnum, 'cancel' => '' } ) ) {
9 Move uncancelled packages to customer number
10 <INPUT TYPE="text" NAME="new_custnum" VALUE="<% $new_custnum |h %>"><BR><BR>
13 This will <B>completely remove</B> all traces of this customer record. This
14 is <B>not</B> what you want if this is a real customer who has simply
15 canceled service with you. For that, cancel all of the customer's packages.
16 (you can optionally hide cancelled customers with the <A HREF="../config/config-view.cgi#hidecancelledcustomers">hidecancelledcustomers</A> configuration option)
18 <BR>Are you <B>absolutely sure</B> you want to delete this customer?
19 <BR><INPUT TYPE="submit" VALUE="Yes">
22 <% include('/elements/footer.html') %>
24 %#Deleting a customer you have financial records on (i.e. credits) is
25 %#typically considered fraudulant bookkeeping. Remember, deleting
26 %#customers should ONLY be used for completely bogus records. You should
27 %#NOT delete real customers who simply discontinue service.
29 %#For real customers who simply discontinue service, cancel all of the
30 %#customer's packages. Customers with all cancelled packages are not
31 %#billed. There is no need to take further action to prevent billing on
32 %#customers with all cancelled packages.
34 %#Also see the "hidecancelledcustomers" and "hidecancelledpackages"
35 %#configuration options, which will allow you to surpress the display of
36 %#cancelled customers and packages, respectively.
40 my $conf = new FS::Conf;
41 die "Customer deletions not enabled in configuration"
42 unless $conf->exists('deletecustomers');
45 unless $FS::CurrentUser::CurrentUser->access_right('Delete customer');
47 my($custnum, $new_custnum);
48 if ( $cgi->param('error') ) {
49 $custnum = $cgi->param('custnum');
50 $new_custnum = $cgi->param('new_custnum');
52 my($query) = $cgi->keywords;
53 $query =~ /^(\d+)$/ or die "Illegal query: $query";
57 my $cust_main = qsearchs( {
58 'table' => 'cust_main',
59 'hashref' => { 'custnum' => $custnum },
60 'extra_sql' => ' AND '. $FS::CurrentUser::CurrentUser->agentnums_sql,
62 or die 'Unknown custnum';