1 <% include('/elements/header.html', {
2 'title' => "Customer View: ". $cust_main->name,
8 <% include('/elements/menubar.html',
10 'selected' => $viewname{$view},
11 'url_base' => $cgi->url. "?custnum=$custnum;show=",
18 <% include('/elements/init_overlib.html') %>
20 <SCRIPT TYPE="text/javascript">
21 function areyousure(href, message) {
22 if (confirm(message) == true)
23 window.location.href = href;
27 % if ( $view eq 'basics' || $view eq 'jumbo' ) {
29 % if ( $curuser->access_right('Edit customer') ) {
30 <A HREF="<% $p %>edit/cust_main.cgi?<% $custnum %>">Edit this customer</A> |
33 % if ( $curuser->access_right('Cancel customer')
34 % && $cust_main->ncancelled_pkgs
37 <% include( '/elements/popup_link-cust_main.html',
38 { 'action' => $p. 'misc/cancel_cust.html',
39 'label' => 'Cancel this customer',
40 'actionlabel' => 'Confirm Cancellation',
42 'cust_main' => $cust_main,
43 'width' => 616, #make room for reasons
50 % if ( $conf->exists('deletecustomers')
51 % && $curuser->access_right('Delete customer')
53 <A HREF="<% $p %>misc/delete-customer.cgi?<% $custnum%>">Delete this customer</A> |
56 % unless ( $conf->exists('disable_customer_referrals') ) {
57 <A HREF="<% $p %>edit/cust_main.cgi?referral_custnum=<% $custnum %>">Refer a new customer</A> |
58 <A HREF="<% $p %>search/cust_main.cgi?referral_custnum=<% $custnum %>">View this customer's referrals</A>
63 % if ( $curuser->access_right('Billing event reports')
64 % || $curuser->access_right('View customer billing events')
67 <A HREF="<% $p %>search/cust_event.html?custnum=<% $custnum %>">View billing events for this customer</A>
72 %my $signupurl = $conf->config('signupurl');
74 This customer's signup URL: <A HREF="<% $signupurl %>?ref=<% $custnum %>"><% $signupurl %>?ref=<% $custnum %></A><BR><BR>
78 <A NAME="cust_main"></A>
82 <% include('cust_main/contacts.html', $cust_main ) %>
84 <TD VALIGN="top" STYLE="padding-left: 54px">
85 <% include('cust_main/misc.html', $cust_main ) %>
86 % if ( $conf->config('payby-default') ne 'HIDE' ) {
89 <% include('cust_main/billing.html', $cust_main ) %>
98 % if ( $view eq 'notes' || $view eq 'jumbo' ) {
100 %if ( $cust_main->comments =~ /[^\s\n\r]/ ) {
103 <% ntable("#cccccc") %><TR><TD><% ntable("#cccccc",2) %>
105 <TD BGCOLOR="#ffffff">
106 <PRE><% encode_entities($cust_main->comments) %></PRE>
113 % my $notecount = scalar($cust_main->notes());
114 % if ( ! $conf->exists('cust_main-disable_notes') || $notecount) {
116 % unless ( $view eq 'notes' && $cust_main->comments !~ /[^\s\n\r]/ ) {
118 <A NAME="cust_main_note"><FONT SIZE="+2">Notes</FONT></A><BR>
121 % if ( $curuser->access_right('Add customer note') &&
122 % ! $conf->exists('cust_main-disable_notes')
125 <% include( '/elements/popup_link-cust_main.html',
126 'label' => 'Add customer note',
127 'action' => $p. 'edit/cust_main_note.cgi',
128 'actionlabel' => 'Enter customer note',
129 'cust_main' => $cust_main,
139 <% include('cust_main/notes.html', 'custnum' => $cust_main->custnum ) %>
144 % if(! $conf->config('disable_cust_attachment')
145 % and $curuser->access_right('Add attachment')) {
146 <% include( '/elements/popup_link-cust_main.html',
147 'label' => 'Attach file',
148 'action' => $p.'edit/cust_main_attach.cgi',
149 'actionlabel' => 'Upload file',
150 'cust_main' => $cust_main,
156 % if( $curuser->access_right('View attachments') ) {
157 <% include('cust_main/attachments.html', 'custnum' => $cust_main->custnum ) %>
158 % if ($cgi->param('show_deleted')) {
159 <A HREF="<% $p.'view/cust_main.cgi?custnum=' . $cust_main->custnum .
160 ($view ? ";show=$view" : '') . '#notes'
161 %>"><I>(Show active attachments)</I></A>
163 % elsif($curuser->access_right('View deleted attachments')) {
164 <A HREF="<% $p.'view/cust_main.cgi?custnum=' . $cust_main->custnum .
165 ($view ? ";show=$view" : '') . ';show_deleted=1#notes'
166 %>"><I>(Show deleted attachments)</I></A>
173 % if ( $view eq 'jumbo' ) {
175 <A NAME="tickets"><FONT SIZE="+2">Tickets</FONT></A><BR>
178 % if ( $view eq 'tickets' || $view eq 'jumbo' ) {
180 % if ( $conf->config('ticket_system') ) {
181 <% include('cust_main/tickets.html', $cust_main ) %>
187 % if ( $view eq 'jumbo' ) { #XXX enable me && $curuser->access_right('View customer packages') {
189 <A NAME="cust_pkg"><FONT SIZE="+2">Packages</FONT></A><BR>
192 % if ( $view eq 'packages' || $view eq 'jumbo' ) {
194 % #XXX enable me# if ( $curuser->access_right('View customer packages') {
195 <% include('cust_main/packages.html', $cust_main ) %>
200 % if ( $view eq 'jumbo' ) {
202 <A NAME="history"><FONT SIZE="+2">Payment History</FONT></A><BR>
205 % if ( $view eq 'payment_history' || $view eq 'jumbo' ) {
207 % if ( $conf->config('payby-default') ne 'HIDE' ) {
208 <% include('cust_main/payment_history.html', $cust_main ) %>
213 % if ( $view eq 'change_history' ) { # || $view eq 'jumbo'
214 <% include('cust_main/change_history.html', $cust_main ) %>
217 <% include('/elements/footer.html') %>
220 my $curuser = $FS::CurrentUser::CurrentUser;
223 unless $curuser->access_right('View customer');
225 my $conf = new FS::Conf;
228 if ( $cgi->param('custnum') =~ /^(\d+)$/ ) {
231 die "No customer specified (bad URL)!" unless $cgi->keywords;
232 my($query) = $cgi->keywords; # needs parens with my, ->keywords returns array
237 my $cust_main = qsearchs( {
238 'table' => 'cust_main',
239 'hashref' => { 'custnum' => $custnum },
240 'extra_sql' => ' AND '. $curuser->agentnums_sql,
242 die "Customer not found!" unless $cust_main;
244 #false laziness w/pref/pref.html and Conf.pm (cust_main-default_view)
245 tie my %views, 'Tie::IxHash',
246 'Basics' => 'basics',
247 'Notes' => 'notes', #notes and files?
249 $views{'Tickets'} = 'tickets'
250 if $conf->config('ticket_system');
251 $views{'Packages'} = 'packages';
252 $views{'Payment History'} = 'payment_history'
253 unless $conf->config('payby-default' eq 'HIDE');
254 $views{'Change History'} = 'change_history'
255 if $curuser->access_right('View customer history');
256 $views{'Jumbo'} = 'jumbo';
258 my %viewname = reverse %views;
260 my $view = $cgi->param('show') || $curuser->default_customer_view;