1 <% include('/elements/header-popup.html', 'Cancel customer' ) %>
3 <% include('/elements/error.html') %>
6 <FORM NAME="cust_cancel_popup" ACTION="<% popurl(1) %>cust_main-cancel.cgi" METHOD=POST>
7 <INPUT TYPE="hidden" NAME="custnum" VALUE="<% $custnum %>">
10 <P ALIGN="center"><B>Permanently delete all services and cancel this customer?</B>
12 <TABLE BORDER="0" CELLSPACING="2"
13 STYLE="margin-left:auto; margin-right:auto">
16 <INPUT TYPE="radio" NAME="now_or_later" VALUE="0" onclick="toggle(false)" CHECKED />
18 <TD ALIGN="left">Cancel now</TD>
22 <INPUT TYPE="radio" NAME="now_or_later" VALUE="1" onclick="toggle(true)" />
24 <TD ALIGN="left">Cancel on date:
25 <% include('/elements/input-date-field.html', {
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';
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',
49 'control_button' => "document.getElementById('confirm_cancel_cust_button')",
57 <INPUT TYPE="submit" NAME="submit" ID="confirm_cancel_cust_button" VALUE="Cancel customer" DISABLED> <INPUT TYPE="BUTTON" VALUE="Don't cancel" onClick="parent.cClick();">
65 $cgi->param('custnum') =~ /^(\d+)$/ or die 'illegal custnum';
68 my $curuser = $FS::CurrentUser::CurrentUser;
70 die "access denied" unless $curuser->access_right('Cancel customer');
72 my $cust_main = qsearchs( {
73 'table' => 'cust_main',
74 'hashref' => { 'custnum' => $custnum },
75 'extra_sql' => ' AND '. $FS::CurrentUser::CurrentUser->agentnums_sql,
77 die "No customer # $custnum" unless $cust_main;
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';