this helps? but this search is still royally fucked by the last changes. RT#23621
[freeside.git] / httemplate / misc / delete-customer.cgi
1 <% include('/elements/header.html', 'Delete customer') %>
2
3 <% include('/elements/error.html') %>
4
5 <FORM ACTION="<% popurl(1) %>process/delete-customer.cgi" METHOD=POST>
6 <INPUT TYPE="hidden" NAME="custnum" VALUE="<% $custnum |h %>">
7
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>
11 %}
12
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)
17 <BR>
18 <BR>Are you <B>absolutely sure</B> you want to delete this customer?
19 <BR><INPUT TYPE="submit" VALUE="Yes">
20 </FORM>
21
22 <% include('/elements/footer.html') %>
23
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.
28 %#
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.
33 %#
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.
37
38 <%init>
39
40 my $conf = new FS::Conf;
41 die "Customer deletions not enabled in configuration"
42   unless $conf->exists('deletecustomers');
43
44 die "access denied"
45   unless $FS::CurrentUser::CurrentUser->access_right('Delete customer');
46
47 my($custnum, $new_custnum);
48 if ( $cgi->param('error') ) {
49   $custnum = $cgi->param('custnum');
50   $new_custnum = $cgi->param('new_custnum');
51 } else {
52   my($query) = $cgi->keywords;
53   $query =~ /^(\d+)$/ or die "Illegal query: $query";
54   $custnum = $1;
55   $new_custnum = '';
56 }
57 my $cust_main = qsearchs( {
58   'table'     => 'cust_main',
59   'hashref'   => { 'custnum' => $custnum },
60   'extra_sql' => ' AND '. $FS::CurrentUser::CurrentUser->agentnums_sql,
61 } )
62   or die 'Unknown custnum';
63
64 </%init>