1 <& /elements/header-popup.html, mt('Cancel customer') &>
3 <& /elements/error.html &>
5 <FORM NAME="cust_cancel_popup" ACTION="<% popurl(1) %>cust_main-cancel.cgi" METHOD=POST>
6 <INPUT TYPE="hidden" NAME="custnum" VALUE="<% $custnum %>">
8 <P ALIGN="center"><B><% mt('Permanently delete all services and cancel this customer?') |h %></B>
10 <TABLE BORDER="0" CELLSPACING="2"
11 STYLE="margin-left:auto; margin-right:auto">
14 <INPUT TYPE="radio" NAME="now_or_later" VALUE="0" onclick="toggle(false)" CHECKED />
16 <TD ALIGN="left"><% mt('Cancel now') |h %></TD>
20 <INPUT TYPE="radio" NAME="now_or_later" VALUE="1" onclick="toggle(true)" />
22 <TD ALIGN="left"><% mt('Cancel on date: ') |h %>
23 <& /elements/input-date-field.html, {
30 <SCRIPT type="text/javascript">
31 function toggle(val) {
32 document.getElementById("expire_text").disabled = !val;
33 document.getElementById("ban").disabled = val;
34 document.getElementById("expire_button").style.visibility =
35 val ? 'visible' : 'hidden';
39 % if ( $cust_main->payby =~ /^(CARD|DCRD|CHEK|DCHK)$/ ) {
40 % my $ban = "Ban this customer's ";
41 % $ban .= 'credit card' if $cust_main->payby =~ /^(CARD|DCRD)$/;
42 % $ban .= 'ACH account' if $cust_main->payby =~ /^(CHEK|DCHK)$/;
44 <INPUT TYPE="checkbox" NAME="ban" ID="ban" VALUE="1"><% mt($ban) |h %>
47 <TABLE BGCOLOR="#cccccc", BORDER="0" CELLSPACING="2"
48 STYLE="margin-left:auto; margin-right:auto">
49 <& /elements/tr-select-reason.html,
50 'field' => 'reasonnum',
51 'reason_class' => 'C',
53 'control_button' => "document.getElementById('confirm_cancel_cust_button')",
60 <INPUT TYPE="submit" NAME="submit" ID="confirm_cancel_cust_button" VALUE="<% mt('Cancel customer') |h %>" DISABLED>
61
62 <INPUT TYPE="BUTTON" VALUE="<% mt("Don't cancel") |h %>" onClick="parent.cClick();">
70 $cgi->param('custnum') =~ /^(\d+)$/ or die 'illegal custnum';
73 my $curuser = $FS::CurrentUser::CurrentUser;
75 die "access denied" unless $curuser->access_right('Cancel customer');
77 my $cust_main = qsearchs( {
78 'table' => 'cust_main',
79 'hashref' => { 'custnum' => $custnum },
80 'extra_sql' => ' AND '. $FS::CurrentUser::CurrentUser->agentnums_sql,
82 die "No customer # $custnum" unless $cust_main;