1 <% include('/elements/header.html', {
7 % my @part_tag = $cust_main->part_tag;
8 % if ( $conf->config('cust_tag-location') eq 'top' && @part_tag ) {
9 <TABLE STYLE="margin-bottom:8px" CELLSPACING=2>
10 % foreach my $part_tag ( @part_tag ) {
14 <% length($part_tag->tagcolor)
15 ? 'STYLE="background-color:#'.$part_tag->tagcolor.'"'
17 %>><% $part_tag->tagname.': '. $part_tag->tagdesc |h %></FONT>
24 <% include('/elements/menubar.html',
26 'selected' => $viewname{$view},
27 'url_base' => $cgi->url. "?custnum=$custnum;show=",
32 <DIV CLASS="fstabcontainer">
34 <% include('/elements/init_overlib.html') %>
36 <SCRIPT TYPE="text/javascript">
37 function areyousure(href, message) {
38 if (confirm(message) == true)
39 window.location.href = href;
43 % if ( $view eq 'basics' || $view eq 'jumbo' ) {
45 % if ( $curuser->access_right('Edit customer') ) {
46 <A HREF="<% $p %>edit/cust_main.cgi?<% $custnum %>">Edit this customer</A> |
49 % if ( $curuser->access_right('Cancel customer')
50 % && $cust_main->ncancelled_pkgs
53 <% include( '/elements/popup_link-cust_main.html',
54 { 'action' => $p. 'misc/cancel_cust.html',
55 'label' => 'Cancel this customer',
56 'actionlabel' => 'Confirm Cancellation',
58 'cust_main' => $cust_main,
59 'width' => 616, #make room for reasons
67 % if ( $curuser->access_right('Merge customer') ) {
69 <% include( '/elements/popup_link-cust_main.html',
70 { 'action' => $p. 'misc/merge_cust.html',
71 'label' => 'Merge this customer',
72 'actionlabel' => 'Merge customer',
73 #'color' => '#ff0000',
74 'cust_main' => $cust_main,
83 % if ( $conf->exists('deletecustomers')
84 % && $curuser->access_right('Delete customer')
86 <A HREF="<% $p %>misc/delete-customer.cgi?<% $custnum%>">Delete this customer</A> |
89 % unless ( $conf->exists('disable_customer_referrals') ) {
90 <A HREF="<% $p %>edit/cust_main.cgi?referral_custnum=<% $custnum %>">Refer a new customer</A> |
91 <A HREF="<% $p %>search/cust_main.cgi?referral_custnum=<% $custnum %>">View this customer's referrals</A>
96 % if ( $curuser->access_right('Billing event reports')
97 % || $curuser->access_right('View customer billing events')
100 <A HREF="<% $p %>search/cust_event.html?custnum=<% $custnum %>">View billing events for this customer</A>
105 %my $signupurl = $conf->config('signupurl');
107 This customer's signup URL: <A HREF="<% $signupurl %>?ref=<% $custnum %>"><% $signupurl %>?ref=<% $custnum %></A><BR><BR>
110 %if ( $conf->exists('maestro-status_test') ) {
111 <A HREF="<% $p %>misc/maestro-customer_status-test.html?<% $custnum %>">Test maestro status</A><BR><BR>
114 <A NAME="cust_main"></A>
118 <% include('cust_main/contacts.html', $cust_main ) %>
120 <TD VALIGN="top" STYLE="padding-left: 54px">
121 <% include('cust_main/misc.html', $cust_main ) %>
122 % if ( $conf->config('payby-default') ne 'HIDE' ) {
125 <% include('cust_main/billing.html', $cust_main ) %>
134 % if ( $view eq 'notes' || $view eq 'jumbo' ) {
136 %if ( $cust_main->comments =~ /[^\s\n\r]/ ) {
139 <% ntable("#cccccc") %><TR><TD><% ntable("#cccccc",2) %>
141 <TD BGCOLOR="#ffffff">
142 <PRE><% encode_entities($cust_main->comments) %></PRE>
149 % my $notecount = scalar($cust_main->notes(0));
150 % if ( ! $conf->exists('cust_main-disable_notes') || $notecount) {
152 % unless ( $view eq 'notes' && $cust_main->comments !~ /[^\s\n\r]/ ) {
154 <A NAME="cust_main_note"><FONT SIZE="+2">Notes</FONT></A><BR>
157 % if ( $curuser->access_right('Add customer note') &&
158 % ! $conf->exists('cust_main-disable_notes')
161 <% include( '/elements/popup_link-cust_main.html',
162 'label' => 'Add customer note',
163 'action' => $p. 'edit/cust_main_note.cgi',
164 'actionlabel' => 'Enter customer note',
165 'cust_main' => $cust_main,
167 'height' => 538, #575
175 <% include('cust_main/notes.html', 'custnum' => $cust_main->custnum ) %>
180 % if(! $conf->config('disable_cust_attachment')
181 % and $curuser->access_right('Add attachment')) {
182 <% include( '/elements/popup_link-cust_main.html',
183 'label' => 'Attach file',
184 'action' => $p.'edit/cust_main_attach.cgi',
185 'actionlabel' => 'Upload file',
186 'cust_main' => $cust_main,
192 % if( $curuser->access_right('View attachments') ) {
193 <% include('cust_main/attachments.html', 'custnum' => $cust_main->custnum ) %>
194 % if ($cgi->param('show_deleted')) {
195 <A HREF="<% $p.'view/cust_main.cgi?custnum=' . $cust_main->custnum .
196 ($view ? ";show=$view" : '') . '#notes'
197 %>"><I>(Show active attachments)</I></A>
199 % elsif($curuser->access_right('View deleted attachments')) {
200 <A HREF="<% $p.'view/cust_main.cgi?custnum=' . $cust_main->custnum .
201 ($view ? ";show=$view" : '') . ';show_deleted=1#notes'
202 %>"><I>(Show deleted attachments)</I></A>
209 % if ( $view eq 'jumbo' ) {
211 <A NAME="tickets"><FONT SIZE="+2">Tickets</FONT></A><BR>
214 % if ( $view eq 'tickets' || $view eq 'jumbo' ) {
216 % if ( $conf->config('ticket_system') ) {
217 <% include('cust_main/tickets.html', $cust_main ) %>
223 % if ( $view eq 'jumbo' ) { #XXX enable me && $curuser->access_right('View customer packages') {
225 <A NAME="cust_pkg"><FONT SIZE="+2">Packages</FONT></A><BR>
228 % if ( $view eq 'packages' || $view eq 'jumbo' ) {
230 % #XXX enable me# if ( $curuser->access_right('View customer packages') {
231 <% include('cust_main/packages.html', $cust_main ) %>
236 % if ( $view eq 'jumbo' ) {
238 <A NAME="history"><FONT SIZE="+2">Payment History</FONT></A><BR>
241 % if ( $view eq 'payment_history' || $view eq 'jumbo' ) {
243 % if ( $conf->config('payby-default') ne 'HIDE' ) {
244 <% include('cust_main/payment_history.html', $cust_main ) %>
249 % if ( $view eq 'change_history' ) { # || $view eq 'jumbo'
250 <% include('cust_main/change_history.html', $cust_main ) %>
253 % if ( $view eq 'custom' ) {
254 <% include('cust_main/custom.html', $cust_main ) %>
258 <% include('/elements/footer.html') %>
261 my $curuser = $FS::CurrentUser::CurrentUser;
264 unless $curuser->access_right('View customer');
266 my $conf = new FS::Conf;
269 if ( $cgi->param('custnum') =~ /^(\d+)$/ ) {
272 die "No customer specified (bad URL)!" unless $cgi->keywords;
273 my($query) = $cgi->keywords; # needs parens with my, ->keywords returns array
278 my $cust_main = qsearchs( {
279 'table' => 'cust_main',
280 'hashref' => { 'custnum' => $custnum },
281 'extra_sql' => ' AND '. $curuser->agentnums_sql,
283 die "Customer not found!" unless $cust_main;
285 my $title = $cust_main->name;
286 $title = '('. $cust_main->display_custnum. ") $title"
287 if $conf->exists('cust_main-title-display_custnum');
288 $title = "Customer: $title";
290 #false laziness w/pref/pref.html and Conf.pm (cust_main-default_view)
291 tie my %views, 'Tie::IxHash',
292 'Basics' => 'basics',
293 'Notes' => 'notes', #notes and files?
295 $views{'Tickets'} = 'tickets'
296 if $conf->config('ticket_system');
297 $views{'Packages'} = 'packages';
298 $views{'Payment History'} = 'payment_history'
299 unless $conf->config('payby-default' eq 'HIDE');
300 $views{'Change History'} = 'change_history'
301 if $curuser->access_right('View customer history');
302 $views{$conf->config('cust_main-custom_title') || 'Custom'} = 'custom'
303 if $conf->config('cust_main-custom_link');
304 $views{'Jumbo'} = 'jumbo';
306 my %viewname = reverse %views;
308 my $view = $cgi->param('show') || $curuser->default_customer_view;