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>
97 % if ( $curuser->access_right('Billing event reports')
98 % || $curuser->access_right('View customer billing events')
101 <A HREF="<% $p %>search/cust_event.html?custnum=<% $custnum %>">View billing events for this customer</A>
104 % if ( $conf->config('cust_main-external_links') ) {
105 <% $br++ ? ' | ' : '' %>
106 % my @links = split(/\n/, $conf->config('menu-prepend_links'));
107 % foreach my $link (@links) {
108 % $link =~ /^\s*(\S+)\s+(.*?)(\s*\(([^\)]*)\))?$/ or next;
109 % my($url, $label, $alt) = ($1, $2, $4);
110 <A HREF="<% $url.$custnum %>" ALT="<% $alt |h %>"><% $label |h %></A>
119 %my $signupurl = $conf->config('signupurl');
121 This customer's signup URL: <A HREF="<% $signupurl %>?ref=<% $custnum %>"><% $signupurl %>?ref=<% $custnum %></A><BR><BR>
124 %if ( $conf->exists('maestro-status_test') ) {
125 <A HREF="<% $p %>misc/maestro-customer_status-test.html?<% $custnum %>">Test maestro status</A><BR><BR>
128 <A NAME="cust_main"></A>
132 <% include('cust_main/contacts.html', $cust_main ) %>
134 <TD VALIGN="top" STYLE="padding-left: 54px">
135 <% include('cust_main/misc.html', $cust_main ) %>
136 % if ( $conf->config('payby-default') ne 'HIDE' ) {
139 <% include('cust_main/billing.html', $cust_main ) %>
148 % if ( $view eq 'notes' || $view eq 'jumbo' ) {
150 %if ( $cust_main->comments =~ /[^\s\n\r]/ ) {
153 <% ntable("#cccccc") %><TR><TD><% ntable("#cccccc",2) %>
155 <TD BGCOLOR="#ffffff">
156 <PRE><% encode_entities($cust_main->comments) %></PRE>
163 % my $notecount = scalar($cust_main->notes());
164 % if ( ! $conf->exists('cust_main-disable_notes') || $notecount) {
166 % unless ( $view eq 'notes' && $cust_main->comments !~ /[^\s\n\r]/ ) {
168 <A NAME="cust_main_note"><FONT SIZE="+2">Notes</FONT></A><BR>
171 % if ( $curuser->access_right('Add customer note') &&
172 % ! $conf->exists('cust_main-disable_notes')
175 <% include( '/elements/popup_link-cust_main.html',
176 'label' => 'Add customer note',
177 'action' => $p. 'edit/cust_main_note.cgi',
178 'actionlabel' => 'Enter customer note',
179 'cust_main' => $cust_main,
181 'height' => 538, #575
189 <% include('cust_main/notes.html', 'custnum' => $cust_main->custnum ) %>
194 % if(! $conf->config('disable_cust_attachment')
195 % and $curuser->access_right('Add attachment')) {
196 <% include( '/elements/popup_link-cust_main.html',
197 'label' => 'Attach file',
198 'action' => $p.'edit/cust_main_attach.cgi',
199 'actionlabel' => 'Upload file',
200 'cust_main' => $cust_main,
206 % if( $curuser->access_right('View attachments') ) {
207 <% include('cust_main/attachments.html', 'custnum' => $cust_main->custnum ) %>
208 % if ($cgi->param('show_deleted')) {
209 <A HREF="<% $p.'view/cust_main.cgi?custnum=' . $cust_main->custnum .
210 ($view ? ";show=$view" : '') . '#notes'
211 %>"><I>(Show active attachments)</I></A>
213 % elsif($curuser->access_right('View deleted attachments')) {
214 <A HREF="<% $p.'view/cust_main.cgi?custnum=' . $cust_main->custnum .
215 ($view ? ";show=$view" : '') . ';show_deleted=1#notes'
216 %>"><I>(Show deleted attachments)</I></A>
223 % if ( $view eq 'jumbo' ) {
225 <A NAME="tickets"><FONT SIZE="+2">Tickets</FONT></A><BR>
228 % if ( $view eq 'tickets' || $view eq 'jumbo' ) {
230 % if ( $conf->config('ticket_system') ) {
231 <% include('cust_main/tickets.html', $cust_main ) %>
237 % if ( $view eq 'jumbo' ) { #XXX enable me && $curuser->access_right('View customer packages') {
239 <A NAME="cust_pkg"><FONT SIZE="+2">Packages</FONT></A><BR>
242 % if ( $view eq 'packages' || $view eq 'jumbo' ) {
244 % #XXX enable me# if ( $curuser->access_right('View customer packages') {
245 <% include('cust_main/packages.html', $cust_main ) %>
250 % if ( $view eq 'jumbo' ) {
252 <A NAME="history"><FONT SIZE="+2">Payment History</FONT></A><BR>
255 % if ( $view eq 'payment_history' || $view eq 'jumbo' ) {
257 % if ( $conf->config('payby-default') ne 'HIDE' ) {
258 <% include('cust_main/payment_history.html', $cust_main ) %>
263 % if ( $view eq 'change_history' ) { # || $view eq 'jumbo'
264 <% include('cust_main/change_history.html', $cust_main ) %>
267 % if ( $view eq 'custom' ) {
268 <% include('cust_main/custom.html', $cust_main ) %>
272 <% include('/elements/footer.html') %>
275 my $curuser = $FS::CurrentUser::CurrentUser;
278 unless $curuser->access_right('View customer');
280 my $conf = new FS::Conf;
283 if ( $cgi->param('custnum') =~ /^(\d+)$/ ) {
286 die "No customer specified (bad URL)!" unless $cgi->keywords;
287 my($query) = $cgi->keywords; # needs parens with my, ->keywords returns array
292 my $cust_main = qsearchs( {
293 'table' => 'cust_main',
294 'hashref' => { 'custnum' => $custnum },
295 'extra_sql' => ' AND '. $curuser->agentnums_sql,
297 die "Customer not found!" unless $cust_main;
299 my $title = $cust_main->name;
300 $title = '('. $cust_main->display_custnum. ") $title"
301 if $conf->exists('cust_main-title-display_custnum');
302 $title = "Customer: $title";
304 #false laziness w/pref/pref.html and Conf.pm (cust_main-default_view)
305 tie my %views, 'Tie::IxHash',
306 'Basics' => 'basics',
307 'Notes' => 'notes', #notes and files?
309 $views{'Tickets'} = 'tickets'
310 if $conf->config('ticket_system');
311 $views{'Packages'} = 'packages';
312 $views{'Payment History'} = 'payment_history'
313 unless $conf->config('payby-default' eq 'HIDE');
314 $views{'Change History'} = 'change_history'
315 if $curuser->access_right('View customer history');
316 $views{$conf->config('cust_main-custom_title') || 'Custom'} = 'custom'
317 if $conf->config('cust_main-custom_link');
318 $views{'Jumbo'} = 'jumbo';
320 my %viewname = reverse %views;
322 my $view = $cgi->param('show') || $curuser->default_customer_view;