event refactor, landing on HEAD!
[freeside.git] / httemplate / misc / cancel_cust.html
1 <% include('/elements/header-popup.html', 'Cancel customer' ) %>
2
3 % if ( $cgi->param('error') ) { 
4   <FONT SIZE="+1" COLOR="#ff0000">Error: <% $cgi->param('error') %></FONT>
5   <BR><BR>
6 % } 
7
8 <FORM NAME="cust_cancel_popup" ACTION="<% popurl(1) %>cust_main-cancel.cgi" METHOD=POST>
9 <INPUT TYPE="hidden" NAME="custnum" VALUE="<% $custnum %>">
10
11
12  <P ALIGN="center"><B>Permanently delete all services and cancel this customer?</B>
13
14  <% $ban %>
15  
16 <BR><BR>
17
18 <% ntable("#cccccc", 2) %>
19
20 <% include('/elements/tr-select-reason.html',
21              'field'          => 'reasonnum',
22              'reason_class'   => 'C',
23              #XXX these need to be sticky on errors too...
24              #'curr_value'     => '',
25              'control_button' => 'document.cust_cancel_popup.submit',
26           )
27 %>
28
29 </TABLE>
30
31 <BR>
32 <P ALIGN="CENTER">
33 <INPUT TYPE="submit" NAME="submit" VALUE="Cancel customer" disabled='true'> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<INPUT TYPE="BUTTON" VALUE="Don't cancel" onClick="parent.cClick();"> 
34
35 </FORM>
36 </BODY>
37 </HTML>
38
39 <%init>
40
41 my($custnum, $reasonnum, $submit, $cust_main, $curuser, $class); 
42 if ( $cgi->param('error') ) {
43   $custnum        = $cgi->param('custnum');
44   $reasonnum     = $cgi->param('reasonnum');
45 } else {
46   my( $query ) = $cgi->keywords;
47   if ( $query =~ /^(\d+)$/ ) {
48     $custnum  = $1;
49   } else {
50     die "illegal query ". $cgi->keywords;
51   }
52 }
53
54 $curuser = $FS::CurrentUser::CurrentUser;
55
56 $cust_main = qsearchs( {
57   'table'     => 'cust_main',
58   'hashref'   => { 'custnum' => $custnum },
59   'extra_sql' => ' AND '. $FS::CurrentUser::CurrentUser->agentnums_sql,
60 } );
61 die "No customer # $custnum" unless $cust_main;
62
63 my $ban = '';
64 if ( $cust_main->payby =~ /^(CARD|DCRD|CHEK|DCHK)$/ ) {
65   $ban = '<BR><P ALIGN="center">'.
66          '<INPUT TYPE="checkbox" NAME="ban" VALUE="1"> Ban this customer\'s ';
67   if ( $cust_main->payby =~ /^(CARD|DCRD)$/ ) {
68     $ban .= 'credit card';
69   } elsif (  $cust_main->payby =~ /^(CHEK|DCHK)$/ ) {
70     $ban .= 'ACH account';
71   }
72 }
73
74 </%init>
75