1 <% include('/elements/header-popup.html', 'Cancel customer' ) %>
3 <% include('/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 %>">
9 <P ALIGN="center"><B>Permanently delete all services and cancel this customer?</B>
15 <% ntable("#cccccc", 2) %>
17 <% include('/elements/tr-select-reason.html', 'reasonnum', 'C', '', '', '', 'document.cust_cancel_popup.submit',
25 <INPUT TYPE="submit" NAME="submit" VALUE="Cancel customer" disabled='true'> <INPUT TYPE="BUTTON" VALUE="Don't cancel" onClick="parent.cClick();">
33 my($custnum, $reasonnum, $submit, $cust_main, $curuser, $class);
34 if ( $cgi->param('error') ) {
35 $custnum = $cgi->param('custnum');
36 $reasonnum = $cgi->param('reasonnum');
38 my( $query ) = $cgi->keywords;
39 if ( $query =~ /^(\d+)$/ ) {
42 die "illegal query ". $cgi->keywords;
46 $curuser = $FS::CurrentUser::CurrentUser;
48 die "access denied" unless $curuser->access_right('Cancel customer');
50 $cust_main = qsearchs( {
51 'table' => 'cust_main',
52 'hashref' => { 'custnum' => $custnum },
53 'extra_sql' => ' AND '. $FS::CurrentUser::CurrentUser->agentnums_sql,
55 die "No customer # $custnum" unless $cust_main;
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';