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',
18              'field'          => 'reasonnum',
19              'reason_class'   => 'C',
20              'cgi'            => $cgi,
21              'control_button' => "document.getElementById('confirm_cancel_cust_button')",
22           )
23 %>
24
25 </TABLE>
26
27 <BR>
28 <P ALIGN="CENTER">
29 <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();"> 
30
31 </FORM>
32 </BODY>
33 </HTML>
34
35 <%init>
36
37 my $reasonnum = '';
38 my($submit, $class);
39
40 $cgi->param('custnum') =~ /^(\d+)$/ or die 'illegal custnum';
41 my $custnum = $1;
42
43 if ( $cgi->param('error') ) {
44   $reasonnum = $cgi->param('reasonnum');
45 }
46
47 my $curuser = $FS::CurrentUser::CurrentUser;
48
49 die "access denied" unless $curuser->access_right('Cancel customer');
50
51 my $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