backport reason selection for whole customer cancel (RT#2872)
[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', 'reasonnum', 'C', '', '', '', 'document.cust_cancel_popup.submit',
21           )
22 %>
23
24 </TABLE>
25
26 <BR>
27 <P ALIGN="CENTER">
28 <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();"> 
29
30 </FORM>
31 </BODY>
32 </HTML>
33
34 <%init>
35
36 my($custnum, $reasonnum, $submit, $cust_main, $curuser, $class); 
37 if ( $cgi->param('error') ) {
38   $custnum        = $cgi->param('custnum');
39   $reasonnum     = $cgi->param('reasonnum');
40 } else {
41   my( $query ) = $cgi->keywords;
42   if ( $query =~ /^(\d+)$/ ) {
43     $custnum  = $1;
44   } else {
45     die "illegal query ". $cgi->keywords;
46   }
47 }
48
49 $curuser = $FS::CurrentUser::CurrentUser;
50
51 $cust_main = qsearchs( {
52   'table'     => 'cust_main',
53   'hashref'   => { 'custnum' => $custnum },
54   'extra_sql' => ' AND '. $FS::CurrentUser::CurrentUser->agentnums_sql,
55 } );
56 die "No customer # $custnum" unless $cust_main;
57
58 my $ban = '';
59 if ( $cust_main->payby =~ /^(CARD|DCRD|CHEK|DCHK)$/ ) {
60   $ban = '<BR><P ALIGN="center">'.
61          '<INPUT TYPE="checkbox" NAME="ban" VALUE="1"> Ban this customer\'s ';
62   if ( $cust_main->payby =~ /^(CARD|DCRD)$/ ) {
63     $ban .= 'credit card';
64   } elsif (  $cust_main->payby =~ /^(CHEK|DCHK)$/ ) {
65     $ban .= 'ACH account';
66   }
67 }
68
69 </%init>
70