popup iframes don't have predictable names anymore, so locate submit buttons by id...
[freeside.git] / httemplate / misc / cancel_cust.html
1 <% include('/elements/header-popup.html', 'Cancel customer' ) %>
2
3 <% include('/elements/error.html') %>
4
5 <FORM NAME="cust_cancel_popup" ACTION="<% popurl(1) %>cust_main-cancel.cgi" METHOD=POST>
6 <INPUT TYPE="hidden" NAME="custnum" VALUE="<% $custnum %>">
7
8
9  <P ALIGN="center"><B>Permanently delete all services and cancel this customer?</B>
10
11  <% $ban %>
12  
13 <BR><BR>
14
15 <% ntable("#cccccc", 2) %>
16
17 <% include('/elements/tr-select-reason.html', 'reasonnum', 'C', '', '', '', "document.getElementById('confirm_cancel_cust_button')",
18           )
19 %>
20
21 </TABLE>
22
23 <BR>
24 <P ALIGN="CENTER">
25 <INPUT TYPE="submit" NAME="submit" ID="confirm_cancel_cust_button" VALUE="Cancel customer" DISABLED> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<INPUT TYPE="BUTTON" VALUE="Don't cancel" onClick="parent.cClick();"> 
26
27 </FORM>
28 </BODY>
29 </HTML>
30
31 <%init>
32
33 my($custnum, $reasonnum, $submit, $cust_main, $curuser, $class); 
34 if ( $cgi->param('error') ) {
35   $custnum        = $cgi->param('custnum');
36   $reasonnum     = $cgi->param('reasonnum');
37 } else {
38   my( $query ) = $cgi->keywords;
39   if ( $query =~ /^(\d+)$/ ) {
40     $custnum  = $1;
41   } else {
42     die "illegal query ". $cgi->keywords;
43   }
44 }
45
46 $curuser = $FS::CurrentUser::CurrentUser;
47
48 die "access denied" unless $curuser->access_right('Cancel customer');
49
50 $cust_main = qsearchs( {
51   'table'     => 'cust_main',
52   'hashref'   => { 'custnum' => $custnum },
53   'extra_sql' => ' AND '. $FS::CurrentUser::CurrentUser->agentnums_sql,
54 } );
55 die "No customer # $custnum" unless $cust_main;
56
57 my $ban = '';
58 if ( $cust_main->payby =~ /^(CARD|DCRD|CHEK|DCHK)$/ ) {
59   $ban = '<BR><P ALIGN="center">'.
60          '<INPUT TYPE="checkbox" NAME="ban" VALUE="1"> Ban this customer\'s ';
61   if ( $cust_main->payby =~ /^(CARD|DCRD)$/ ) {
62     $ban .= 'credit card';
63   } elsif (  $cust_main->payby =~ /^(CHEK|DCHK)$/ ) {
64     $ban .= 'ACH account';
65   }
66 }
67
68 </%init>
69