1 <% include('/elements/header.html', {
8 % my @part_tag = $cust_main->part_tag;
9 % if ( $conf->config('cust_tag-location') eq 'top' && @part_tag ) {
10 <TABLE STYLE="margin-bottom:8px" CELLSPACING=2>
11 % foreach my $part_tag ( @part_tag ) {
15 <% length($part_tag->tagcolor)
16 ? 'STYLE="background-color:#'.$part_tag->tagcolor.'"'
18 %>><% $part_tag->tagname.': '. $part_tag->tagdesc |h %></FONT>
25 <% include('/elements/menubar.html',
27 'selected' => $viewname{$view},
28 'url_base' => $cgi->url. "?custnum=$custnum;show=",
33 <DIV CLASS="fstabcontainer">
35 <% include('/elements/init_overlib.html') %>
37 <SCRIPT TYPE="text/javascript">
38 function areyousure(href, message) {
39 if (confirm(message) == true)
40 window.location.href = href;
44 % if ( $view eq 'basics' || $view eq 'jumbo' ) {
46 % if ( $curuser->access_right('Edit customer') ) {
47 <A HREF="<% $p %>edit/cust_main.cgi?<% $custnum %>">Edit this customer</A> |
50 % if ( $curuser->access_right('Cancel customer')
51 % && $cust_main->ncancelled_pkgs
54 <% include( '/elements/popup_link-cust_main.html',
55 { 'action' => $p. 'misc/cancel_cust.html',
56 'label' => 'Cancel this customer',
57 'actionlabel' => 'Confirm Cancellation',
59 'cust_main' => $cust_main,
60 'width' => 616, #make room for reasons
68 % if ( $curuser->access_right('Merge customer') ) {
70 <% include( '/elements/popup_link-cust_main.html',
71 { 'action' => $p. 'misc/merge_cust.html',
72 'label' => 'Merge this customer',
73 'actionlabel' => 'Merge customer',
74 #'color' => '#ff0000',
75 'cust_main' => $cust_main,
84 % if ( $conf->exists('deletecustomers')
85 % && $curuser->access_right('Delete customer')
87 <A HREF="<% $p %>misc/delete-customer.cgi?<% $custnum%>">Delete this customer</A> |
90 % unless ( $conf->exists('disable_customer_referrals') ) {
91 <A HREF="<% $p %>edit/cust_main.cgi?referral_custnum=<% $custnum %>">Refer a new customer</A> |
92 <A HREF="<% $p %>search/cust_main.cgi?referral_custnum=<% $custnum %>">View this customer's referrals</A>
98 % if ( $curuser->access_right('Billing event reports')
99 % || $curuser->access_right('View customer billing events')
102 <A HREF="<% $p %>search/cust_event.html?custnum=<% $custnum %>">View billing events for this customer</A>
105 % if ( $conf->config('cust_main-external_links') ) {
106 <% $br++ ? ' | ' : '' %>
107 % my @links = split(/\n/, $conf->config('cust_main-external_links'));
108 % foreach my $link (@links) {
109 % $link =~ /^\s*(\S+)\s+(.*?)(\s*\(([^\)]*)\))?$/ or next;
110 % my($url, $label, $alt) = ($1, $2, $4);
111 <A HREF="<% $url.$custnum %>" ALT="<% $alt |h %>"><% $label |h %></A>
120 %my $signupurl = $conf->config('signupurl');
122 This customer's signup URL: <A HREF="<% $signupurl %>?ref=<% $custnum %>"><% $signupurl %>?ref=<% $custnum %></A><BR><BR>
125 %if ( $conf->exists('maestro-status_test') ) {
126 <A HREF="<% $p %>misc/maestro-customer_status-test.html?<% $custnum %>">Test maestro status</A><BR><BR>
129 <A NAME="cust_main"></A>
133 <% include('cust_main/contacts.html', $cust_main ) %>
135 <TD VALIGN="top" STYLE="padding-left: 54px">
136 <% include('cust_main/misc.html', $cust_main ) %>
137 % if ( $conf->config('payby-default') ne 'HIDE' ) {
140 <% include('cust_main/billing.html', $cust_main ) %>
149 % if ( $view eq 'notes' || $view eq 'jumbo' ) {
151 %if ( $cust_main->comments =~ /[^\s\n\r]/ ) {
154 <% ntable("#cccccc") %><TR><TD><% ntable("#cccccc",2) %>
156 <TD BGCOLOR="#ffffff">
157 <PRE><% encode_entities($cust_main->comments) %></PRE>
164 % my $notecount = scalar($cust_main->notes(0));
165 % if ( ! $conf->exists('cust_main-disable_notes') || $notecount) {
167 % unless ( $view eq 'notes' && $cust_main->comments !~ /[^\s\n\r]/ ) {
169 <A NAME="cust_main_note"><FONT SIZE="+2">Notes</FONT></A><BR>
172 % if ( $curuser->access_right('Add customer note') &&
173 % ! $conf->exists('cust_main-disable_notes')
176 <% include( '/elements/popup_link-cust_main.html',
177 'label' => 'Add customer note',
178 'action' => $p. 'edit/cust_main_note.cgi',
179 'actionlabel' => 'Enter customer note',
180 'cust_main' => $cust_main,
182 'height' => 538, #575
190 <% include('cust_main/notes.html', 'custnum' => $cust_main->custnum ) %>
195 % if(! $conf->config('disable_cust_attachment')
196 % and $curuser->access_right('Add attachment')) {
197 <% include( '/elements/popup_link-cust_main.html',
198 'label' => 'Attach file',
199 'action' => $p.'edit/cust_main_attach.cgi',
200 'actionlabel' => 'Upload file',
201 'cust_main' => $cust_main,
207 % if( $curuser->access_right('View attachments') ) {
208 <% include('cust_main/attachments.html', 'custnum' => $cust_main->custnum ) %>
209 % if ($cgi->param('show_deleted')) {
210 <A HREF="<% $p.'view/cust_main.cgi?custnum=' . $cust_main->custnum .
211 ($view ? ";show=$view" : '') . '#notes'
212 %>"><I>(Show active attachments)</I></A>
214 % elsif($curuser->access_right('View deleted attachments')) {
215 <A HREF="<% $p.'view/cust_main.cgi?custnum=' . $cust_main->custnum .
216 ($view ? ";show=$view" : '') . ';show_deleted=1#notes'
217 %>"><I>(Show deleted attachments)</I></A>
224 % if ( $view eq 'jumbo' ) {
226 <A NAME="tickets"><FONT SIZE="+2">Tickets</FONT></A><BR>
229 % if ( $view eq 'tickets' || $view eq 'jumbo' ) {
231 % if ( $conf->config('ticket_system') ) {
232 <% include('cust_main/tickets.html', $cust_main ) %>
238 % if ( $view eq 'jumbo' ) { #XXX enable me && $curuser->access_right('View customer packages') {
240 <A NAME="cust_pkg"><FONT SIZE="+2">Packages</FONT></A><BR>
243 % if ( $view eq 'packages' || $view eq 'jumbo' ) {
245 % #XXX enable me# if ( $curuser->access_right('View customer packages') {
246 <% include('cust_main/packages.html', $cust_main ) %>
251 % if ( $view eq 'jumbo' ) {
253 <A NAME="history"><FONT SIZE="+2">Payment History</FONT></A><BR>
256 % if ( $view eq 'payment_history' || $view eq 'jumbo' ) {
258 % if ( $conf->config('payby-default') ne 'HIDE' ) {
259 <% include('cust_main/payment_history.html', $cust_main ) %>
264 % if ( $view eq 'change_history' ) { # || $view eq 'jumbo'
265 <% include('cust_main/change_history.html', $cust_main ) %>
268 % if ( $view eq 'custom' ) {
269 <% include('cust_main/custom.html', $cust_main ) %>
273 <% include('/elements/footer.html') %>
276 my $curuser = $FS::CurrentUser::CurrentUser;
279 unless $curuser->access_right('View customer');
281 my $conf = new FS::Conf;
284 if ( $cgi->param('custnum') =~ /^(\d+)$/ ) {
287 die "No customer specified (bad URL)!" unless $cgi->keywords;
288 my($query) = $cgi->keywords; # needs parens with my, ->keywords returns array
293 my $cust_main = qsearchs( {
294 'table' => 'cust_main',
295 'hashref' => { 'custnum' => $custnum },
296 'extra_sql' => ' AND '. $curuser->agentnums_sql,
298 die "Customer not found!" unless $cust_main;
300 my $title = $cust_main->name;
301 $title = '('. $cust_main->display_custnum. ") $title"
302 if $conf->exists('cust_main-title-display_custnum');
303 $title = "Customer: $title";
305 #false laziness w/pref/pref.html and Conf.pm (cust_main-default_view)
306 tie my %views, 'Tie::IxHash',
307 'Basics' => 'basics',
308 'Notes' => 'notes', #notes and files?
310 $views{'Tickets'} = 'tickets'
311 if $conf->config('ticket_system');
312 $views{'Packages'} = 'packages';
313 $views{'Payment History'} = 'payment_history'
314 unless $conf->config('payby-default' eq 'HIDE');
315 $views{'Change History'} = 'change_history'
316 if $curuser->access_right('View customer history');
317 $views{$conf->config('cust_main-custom_title') || 'Custom'} = 'custom'
318 if $conf->config('cust_main-custom_link');
319 $views{'Jumbo'} = 'jumbo';
321 my %viewname = reverse %views;
323 my $view = $cgi->param('show') || $curuser->default_customer_view;
325 my $ie_compat = $conf->config('ie-compatibility_mode');
328 $head = qq(<meta http-equiv="X-UA-Compatible" content="IE=$ie_compat" />);