This commit was generated by cvs2svn to compensate for changes in r10640,
[freeside.git] / httemplate / misc / cancel_cust.html
1 <% include('/elements/header-popup.html', 'Cancel customer' ) %>
2
3 <% include('/elements/error.html') %>
4
5
6 <FORM NAME="cust_cancel_popup" ACTION="<% popurl(1) %>cust_main-cancel.cgi" METHOD=POST>
7 <INPUT TYPE="hidden" NAME="custnum" VALUE="<% $custnum %>">
8
9
10  <P ALIGN="center"><B>Permanently delete all services and cancel this customer?</B>
11
12 <TABLE BORDER="0" CELLSPACING="2"
13 STYLE="margin-left:auto; margin-right:auto">
14 <TR>
15   <TD ALIGN="right">
16     <INPUT TYPE="radio" NAME="now_or_later" VALUE="0" onclick="toggle(false)" CHECKED />
17   </TD>
18   <TD ALIGN="left">Cancel now</TD>
19 </TR>
20 <TR>
21   <TD ALIGN="right">
22     <INPUT TYPE="radio" NAME="now_or_later" VALUE="1" onclick="toggle(true)" />
23   </TD>
24   <TD ALIGN="left">Cancel on date:&nbsp;
25   <% include('/elements/input-date-field.html', {
26               'name'    => 'expire',
27               'value'   => time,
28     } ) %>
29   </TD>
30 </TR>
31 </TABLE>
32 <SCRIPT type="text/javascript">
33 function toggle(val) {
34   document.getElementById("expire_text").disabled = !val;
35   document.getElementById("ban").disabled = val;
36   document.getElementById("expire_button").style.visibility = 
37     val ? 'visible' : 'hidden';
38 }
39 toggle(false);
40 </SCRIPT> 
41 <% $ban %>
42
43 <TABLE BGCOLOR="#cccccc", BORDER="0" CELLSPACING="2"
44 STYLE="margin-left:auto; margin-right:auto">
45 <% include('/elements/tr-select-reason.html',
46              'field'          => 'reasonnum',
47              'reason_class'   => 'C',
48              'cgi'            => $cgi,
49              'control_button' => "document.getElementById('confirm_cancel_cust_button')",
50           )
51 %>
52
53 </TABLE>
54
55 <BR>
56 <P ALIGN="CENTER">
57 <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();"> 
58
59 </FORM>
60 </BODY>
61 </HTML>
62
63 <%init>
64
65 $cgi->param('custnum') =~ /^(\d+)$/ or die 'illegal custnum';
66 my $custnum = $1;
67
68 my $curuser = $FS::CurrentUser::CurrentUser;
69
70 die "access denied" unless $curuser->access_right('Cancel customer');
71
72 my $cust_main = qsearchs( {
73   'table'     => 'cust_main',
74   'hashref'   => { 'custnum' => $custnum },
75   'extra_sql' => ' AND '. $FS::CurrentUser::CurrentUser->agentnums_sql,
76 } );
77 die "No customer # $custnum" unless $cust_main;
78
79 my $ban = '';
80 if ( $cust_main->payby =~ /^(CARD|DCRD|CHEK|DCHK)$/ ) {
81   $ban = '<P ALIGN="center">'.
82          '<INPUT TYPE="checkbox" NAME="ban" ID="ban" VALUE="1"> Ban this customer\'s ';
83   if ( $cust_main->payby =~ /^(CARD|DCRD)$/ ) {
84     $ban .= 'credit card';
85   } elsif (  $cust_main->payby =~ /^(CHEK|DCHK)$/ ) {
86     $ban .= 'ACH account';
87   }
88 }
89
90 </%init>
91