summaryrefslogtreecommitdiff
path: root/httemplate/misc/cancel_cust.html
blob: bb4e1904a0e95776084237578374eb41b262f5ef (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
<% include('/elements/header-popup.html', 'Cancel customer' ) %>

<% include('/elements/error.html') %>

<FORM NAME="cust_cancel_popup" ACTION="<% popurl(1) %>cust_main-cancel.cgi" METHOD=POST>
<INPUT TYPE="hidden" NAME="custnum" VALUE="<% $custnum %>">


 <P ALIGN="center"><B>Permanently delete all services and cancel this customer?</B>

 <% $ban %>
 
<BR><BR>

<% ntable("#cccccc", 2) %>

<% include('/elements/tr-select-reason.html',
             'field'          => 'reasonnum',
             'reason_class'   => 'C',
             #XXX these need to be sticky on errors too...
             #'curr_value'     => '',
             'control_button' => 'document.cust_cancel_popup.submit',
          )
%>

</TABLE>

<BR>
<P ALIGN="CENTER">
<INPUT TYPE="submit" NAME="submit" VALUE="Cancel customer" disabled='true'> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<INPUT TYPE="BUTTON" VALUE="Don't cancel" onClick="parent.cClick();"> 

</FORM>
</BODY>
</HTML>

<%init>

my($custnum, $reasonnum, $submit, $cust_main, $curuser, $class); 
if ( $cgi->param('error') ) {
  $custnum        = $cgi->param('custnum');
  $reasonnum     = $cgi->param('reasonnum');
} else {
  my( $query ) = $cgi->keywords;
  if ( $query =~ /^(\d+)$/ ) {
    $custnum  = $1;
  } else {
    die "illegal query ". $cgi->keywords;
  }
}

$curuser = $FS::CurrentUser::CurrentUser;

die "access denied" unless $curuser->access_right('Cancel customer');

$cust_main = qsearchs( {
  'table'     => 'cust_main',
  'hashref'   => { 'custnum' => $custnum },
  'extra_sql' => ' AND '. $FS::CurrentUser::CurrentUser->agentnums_sql,
} );
die "No customer # $custnum" unless $cust_main;

my $ban = '';
if ( $cust_main->payby =~ /^(CARD|DCRD|CHEK|DCHK)$/ ) {
  $ban = '<BR><P ALIGN="center">'.
         '<INPUT TYPE="checkbox" NAME="ban" VALUE="1"> Ban this customer\'s ';
  if ( $cust_main->payby =~ /^(CARD|DCRD)$/ ) {
    $ban .= 'credit card';
  } elsif (  $cust_main->payby =~ /^(CHEK|DCHK)$/ ) {
    $ban .= 'ACH account';
  }
}

</%init>