chill FF wrt POSTDATA
[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 ( $cust_main->comments =~ /[^\s\n\r]/ ) {
106 %
107
108 <BR>
109 Comments
110 <% ntable("#cccccc") %><TR><TD><% ntable("#cccccc",2) %>
111 <TR>
112   <TD BGCOLOR="#ffffff">
113     <PRE><% encode_entities($cust_main->comments) %></PRE>
114   </TD>
115 </TR>
116 </TABLE></TABLE>
117 % } 
118 <BR><BR>
119 % my $notecount = scalar($cust_main->notes());
120 % if ( ! $conf->exists('cust_main-disable_notes') || $notecount) {
121
122 <A NAME="cust_main_note"><FONT SIZE="+2">Notes</FONT></A><BR>
123 %   if ( $curuser->access_right('Add customer note') &&
124 %        ! $conf->exists('cust_main-disable_notes')
125 %      ) {
126
127   <A HREF="javascript:void(0);" onClick="overlib( OLiframeContent('<% $p %>edit/cust_main_note.cgi?custnum=<% $cust_main->custnum %>', 616, 386, 'cust_main_note_popup' ), CAPTION, 'Enter customer note', STICKY, AUTOSTATUSCAP, MIDX, 0, MIDY, 0, DRAGGABLE, CLOSECLICK); return false;">Add customer note</A>
128
129 %   }
130
131 <BR>
132
133 %   if ($notecount) {
134
135 <iframe src="<% $p %>view/cust_main/notes.html?custnum=<% $cust_main->custnum %>" height="186" width="616" name="cust_main_notes" frameborder="0" marginborder="0" marginheight="0" scrolling="auto">
136   <div><br>[iframe not supported]<br><br></div>
137 </iframe>
138
139 %   }else{ # make firefox happy wrt POSTDATA
140
141 <iframe src="<% $p %>view/cust_main/notes.html?custnum=<% $cust_main->custnum %>" height="18" width="6" name="cust_main_notes" frameborder="0" marginborder="0" marginheight="0" scrolling="auto">
142   <div><br>[iframe not supported]<br><br></div>
143 </iframe>
144
145 %   }
146
147 % }
148
149
150 % if ( $conf->config('ticket_system') ) { 
151
152   <BR><BR>
153   <% include('cust_main/tickets.html', $cust_main ) %>
154 % } 
155
156
157 <BR><BR>
158 <% include('cust_main/packages.html', $cust_main ) %>
159 % if ( $conf->config('payby-default') ne 'HIDE' ) { 
160
161   <% include('cust_main/payment_history.html', $cust_main ) %>
162 % } 
163
164
165 <% include('/elements/footer.html') %>