This commit was generated by cvs2svn to compensate for changes in r6255,
[freeside.git] / httemplate / misc / cancel_cust.html
1 <% include('/elements/header-popup.html', 'Cancel customer' ) %>
2
3 <% include('/elements/error.html') %>
4
5 <FORM NAME="cust_cancel_popup" ACTION="<% popurl(1) %>cust_main-cancel.cgi" METHOD=POST>
6 <INPUT TYPE="hidden" NAME="custnum" VALUE="<% $custnum %>">
7
8
9  <P ALIGN="center"><B>Permanently delete all services and cancel this customer?</B>
10
11  <% $ban %>
12  
13 <BR><BR>
14
15 <% ntable("#cccccc", 2) %>
16
17 <% include('/elements/tr-select-reason.html',
18              'field'          => 'reasonnum',
19              'reason_class'   => 'C',
20              #XXX these need to be sticky on errors too...
21              #'curr_value'     => '',
22              'control_button' => 'document.cust_cancel_popup.submit',
23           )
24 %>
25
26 </TABLE>
27
28 <BR>
29 <P ALIGN="CENTER">
30 <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();"> 
31
32 </FORM>
33 </BODY>
34 </HTML>
35
36 <%init>
37
38 my($custnum, $reasonnum, $submit, $cust_main, $curuser, $class); 
39 if ( $cgi->param('error') ) {
40   $custnum        = $cgi->param('custnum');
41   $reasonnum     = $cgi->param('reasonnum');
42 } else {
43   my( $query ) = $cgi->keywords;
44   if ( $query =~ /^(\d+)$/ ) {
45     $custnum  = $1;
46   } else {
47     die "illegal query ". $cgi->keywords;
48   }
49 }
50
51 $curuser = $FS::CurrentUser::CurrentUser;
52
53 die "access denied" unless $curuser->access_right('Cancel customer');
54
55 $cust_main = qsearchs( {
56   'table'     => 'cust_main',
57   'hashref'   => { 'custnum' => $custnum },
58   'extra_sql' => ' AND '. $FS::CurrentUser::CurrentUser->agentnums_sql,
59 } );
60 die "No customer # $custnum" unless $cust_main;
61
62 my $ban = '';
63 if ( $cust_main->payby =~ /^(CARD|DCRD|CHEK|DCHK)$/ ) {
64   $ban = '<BR><P ALIGN="center">'.
65          '<INPUT TYPE="checkbox" NAME="ban" VALUE="1"> Ban this customer\'s ';
66   if ( $cust_main->payby =~ /^(CARD|DCRD)$/ ) {
67     $ban .= 'credit card';
68   } elsif (  $cust_main->payby =~ /^(CHEK|DCHK)$/ ) {
69     $ban .= 'ACH account';
70   }
71 }
72
73 </%init>
74