Will things ever be the same again?
[freeside.git] / httemplate / view / cust_main.cgi
1 %
2 %
3 %my $conf = new FS::Conf;
4 %
5 %my $curuser = $FS::CurrentUser::CurrentUser;
6 %
7 %die "No customer specified (bad URL)!" unless $cgi->keywords;
8 %my($query) = $cgi->keywords; # needs parens with my, ->keywords returns array
9 %$query =~ /^(\d+)$/;
10 %my $custnum = $1;
11 %my $cust_main = qsearchs('cust_main',{'custnum'=>$custnum});
12 %die "Customer not found!" unless $cust_main;
13 %
14 %
15
16
17 <% include("/elements/header.html","Customer View: ". $cust_main->name ) %>
18 % if ( $curuser->access_right('Edit customer') ) { 
19
20   <A HREF="<% $p %>edit/cust_main.cgi?<% $custnum %>">Edit this customer</A> | 
21 % } 
22
23
24
25 <SCRIPT TYPE="text/javascript" SRC="../elements/overlibmws.js"></SCRIPT>
26 <SCRIPT TYPE="text/javascript" SRC="../elements/overlibmws_iframe.js"></SCRIPT>
27 <SCRIPT TYPE="text/javascript" SRC="../elements/overlibmws_draggable.js"></SCRIPT>
28 <SCRIPT TYPE="text/javascript" SRC="../elements/iframecontentmws.js"></SCRIPT>
29
30 <SCRIPT TYPE="text/javascript">
31 function areyousure(href, message) {
32   if (confirm(message) == true)
33     window.location.href = href;
34 }
35 </SCRIPT>
36
37 <SCRIPT TYPE="text/javascript">
38 %
39 %my $ban = '';
40 %if ( $cust_main->payby =~ /^(CARD|DCRD|CHEK|DCHK)$/ ) {
41 %  $ban = '<BR><P ALIGN="center">'.
42 %         '<INPUT TYPE="checkbox" NAME="ban" VALUE="1"> Ban this customer\\\'s ';
43 %  if ( $cust_main->payby =~ /^(CARD|DCRD)$/ ) {
44 %    $ban .= 'credit card';
45 %  } elsif (  $cust_main->payby =~ /^(CHEK|DCHK)$/ ) {
46 %    $ban .= 'ACH account';
47 %  }
48 %}
49 %
50
51
52 var confirm_cancel = '<FORM METHOD="POST" ACTION="<% $p %>misc/cust_main-cancel.cgi"> <INPUT TYPE="hidden" NAME="custnum" VALUE="<% $custnum %>"> <BR><P ALIGN="center"><B>Permanently delete all services and cancel this customer?</B> <% $ban%><BR><P ALIGN="CENTER"> <INPUT TYPE="submit" VALUE="Cancel customer">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<INPUT TYPE="BUTTON" VALUE="Don\'t cancel" onClick="cClick()"> </FORM> ';
53
54 </SCRIPT>
55 % if ( $curuser->access_right('Cancel customer')
56 %        && $cust_main->ncancelled_pkgs
57 %      ) {
58 %
59
60   <A HREF="javascript:void(0);" onClick="overlib(confirm_cancel, CAPTION, 'Confirm cancellation', STICKY, AUTOSTATUSCAP, CLOSETEXT, '', MIDX, 0, MIDY, 0, DRAGGABLE, WIDTH, 576, HEIGHT, 128, TEXTSIZE, 3, BGCOLOR, '#ff0000', CGCOLOR, '#ff0000' ); return false; ">Cancel this customer</A> | 
61 % } 
62 % if ( $conf->exists('deletecustomers')
63 %        && $curuser->access_right('Delete customer')
64 %      ) {
65 %
66
67   <A HREF="<% $p %>misc/delete-customer.cgi?<% $custnum%>">Delete this customer</A> | 
68 % } 
69 % unless ( $conf->exists('disable_customer_referrals') ) { 
70
71   <A HREF="<% popurl(2) %>edit/cust_main.cgi?referral_custnum=<% $custnum %>">Refer a new customer</A> | 
72   <A HREF="<% popurl(2) %>search/cust_main.cgi?referral_custnum=<% $custnum %>">View this customer's referrals</A>
73 % } 
74
75
76
77 <BR><BR>
78 %
79 %my $signupurl = $conf->config('signupurl');
80 %if ( $signupurl ) {
81 %
82
83   This customer's signup URL: <A HREF="<% $signupurl %>?ref=<% $custnum %>"><% $signupurl %>?ref=<% $custnum %></A><BR><BR>
84 % } 
85
86
87 <A NAME="cust_main"></A>
88 <TABLE BORDER=0>
89 <TR>
90   <TD VALIGN="top">
91     <% include('cust_main/contacts.html', $cust_main ) %>
92   </TD>
93   <TD VALIGN="top" STYLE="padding-left: 54px">
94     <% include('cust_main/misc.html', $cust_main ) %>
95 % if ( $conf->config('payby-default') ne 'HIDE' ) { 
96
97       <BR>
98       <% include('cust_main/billing.html', $cust_main ) %>
99 % } 
100
101   </TD>
102 </TR>
103 </TABLE>
104 %
105 %if ( defined $cust_main->dbdef_table->column('comments')
106 %     && $cust_main->comments =~ /[^\s\n\r]/              ) {
107 %
108
109 <BR>
110 Comments
111 <% ntable("#cccccc") %><TR><TD><% ntable("#cccccc",2) %>
112 <TR>
113   <TD BGCOLOR="#ffffff">
114     <PRE><% encode_entities($cust_main->comments) %></PRE>
115   </TD>
116 </TR>
117 </TABLE></TABLE>
118 % } 
119 % if ( $conf->config('ticket_system') ) { 
120
121   <BR>
122   <% include('cust_main/tickets.html', $cust_main ) %>
123 % } 
124
125
126 <BR><BR>
127 <% include('cust_main/packages.html', $cust_main ) %>
128 % if ( $conf->config('payby-default') ne 'HIDE' ) { 
129
130   <% include('cust_main/payment_history.html', $cust_main ) %>
131 % } 
132
133
134 <% include('/elements/footer.html') %>