1 <& /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 <& /elements/menubar.html,
27 'selected' => $viewname{$view},
28 'url_base' => $cgi->url. "?custnum=$custnum;show=",
32 <DIV CLASS="fstabcontainer">
34 <& /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 %>"><% mt('Edit this customer') |h %></A> |
49 % if ( $curuser->access_right('Cancel customer')
50 % && $cust_main->ncancelled_pkgs
53 <& /elements/popup_link-cust_main.html,
54 { 'action' => $p. 'misc/cancel_cust.html',
55 'label' => emt('Cancel this customer'),
56 'actionlabel' => emt('Confirm Cancellation'),
58 'cust_main' => $cust_main,
59 'width' => 616, #make room for reasons
66 % if ( $curuser->access_right('Merge customer') ) {
68 <& /elements/popup_link-cust_main.html,
69 { 'action' => $p. 'misc/merge_cust.html',
70 'label' => emt('Merge this customer'),
71 'actionlabel' => emt('Merge customer'),
72 'cust_main' => $cust_main,
80 % if ( $conf->exists('deletecustomers')
81 % && $curuser->access_right('Delete customer')
83 <A HREF="<% $p %>misc/delete-customer.cgi?<% $custnum%>"><% mt('Delete this customer') |h %></A> |
86 % unless ( $conf->exists('disable_customer_referrals') ) {
87 <A HREF="<% $p %>edit/cust_main.cgi?referral_custnum=<% $custnum %>"><% mt('Refer a new customer') |h %></A> |
88 <A HREF="<% $p %>search/cust_main.cgi?referral_custnum=<% $custnum %>"><% mt('View this customer\'s referrals') |h %></A>
94 % if ( $curuser->access_right('Billing event reports')
95 % || $curuser->access_right('View customer billing events')
98 <A HREF="<% $p %>search/cust_event.html?custnum=<% $custnum %>"><% mt('View billing events for this customer') |h %></A>
101 % my $email_link = ($cust_main->invoicing_list_emailonly) &&
102 % include('/elements/email-link.html',
103 % 'table' => 'cust_main',
104 % 'search_hash' => { 'custnum' => $custnum },
105 % 'label' => 'Email a notice to this customer',
107 % if ( $email_link and $br ) {
110 <% $email_link || '' %>
112 % if ( $conf->config('cust_main-external_links') ) {
113 <% $br++ ? ' | ' : '' %>
114 % my @links = split(/\n/, $conf->config('cust_main-external_links'));
115 % foreach my $link (@links) {
116 % $link =~ /^\s*(\S+)\s+(.*?)(\s*\(([^\)]*)\))?$/ or next;
117 % my($url, $label, $alt) = ($1, $2, $4);
118 <A HREF="<% $url.$custnum %>" ALT="<% $alt |h %>"><% $label |h %></A>
127 %my $signupurl = $conf->config('signupurl');
129 <% mt('This customer\'s signup URL:') |h %>
130 <A HREF="<% $signupurl %>?ref=<% $custnum %>"><% $signupurl %>?ref=<% $custnum %></A>
134 %if ( $conf->exists('maestro-status_test') ) {
135 <A HREF="<% $p %>misc/maestro-customer_status-test.html?<% $custnum %>"><% mt('Test maestro status') |h %></A>
139 <A NAME="cust_main"></A>
143 <& cust_main/contacts.html, $cust_main &>
145 <TD VALIGN="top" STYLE="padding-left: 54px">
146 <& cust_main/misc.html, $cust_main &>
147 % if ( $conf->config('payby-default') ne 'HIDE' ) {
148 <BR><& cust_main/billing.html, $cust_main &>
155 <& cust_main/contacts_new.html, $cust_main &>
162 % if ( $view eq 'notes' || $view eq 'jumbo' ) {
164 %if ( $cust_main->comments =~ /[^\s\n\r]/ ) {
165 <BR><% mt('Comments') |h %>
166 <% ntable("#cccccc") %><TR><TD><% ntable("#cccccc",2) %>
168 <TD BGCOLOR="#ffffff">
169 <PRE><% encode_entities($cust_main->comments) %></PRE>
176 % my $notecount = scalar($cust_main->notes(0));
177 % if ( ! $conf->exists('cust_main-disable_notes') || $notecount) {
179 % unless ( $view eq 'notes' && $cust_main->comments !~ /[^\s\n\r]/ ) {
181 <A NAME="cust_main_note"><FONT SIZE="+2"><% mt('Notes') |h %></FONT></A><BR>
184 % if ( $curuser->access_right('Add customer note') &&
185 % ! $conf->exists('cust_main-disable_notes')
188 <& /elements/popup_link-cust_main.html,
189 'label' => emt('Add customer note'),
190 'action' => $p. 'edit/cust_main_note.cgi',
191 'actionlabel' => emt('Enter customer note'),
192 'cust_main' => $cust_main,
194 'height' => 538, #575
201 <& cust_main/notes.html, 'custnum' => $cust_main->custnum &>
206 % if(! $conf->config('disable_cust_attachment')
207 % and $curuser->access_right('Add attachment')) {
208 <& /elements/popup_link-cust_main.html,
209 'label' => emt('Attach file'),
210 'action' => $p.'edit/cust_main_attach.cgi',
211 'actionlabel' => emt('Upload file'),
212 'cust_main' => $cust_main,
217 % if( $curuser->access_right('View attachments') ) {
218 <& cust_main/attachments.html, 'custnum' => $cust_main->custnum &>
219 % if ($cgi->param('show_deleted')) {
220 <A HREF="<% $p.'view/cust_main.cgi?custnum=' . $cust_main->custnum .
221 ($view ? ";show=$view" : '') . '#notes'
222 %>"><I>(<% mt('Show active attachments') |h %>)</I></A>
224 % elsif($curuser->access_right('View deleted attachments')) {
225 <A HREF="<% $p.'view/cust_main.cgi?custnum=' . $cust_main->custnum .
226 ($view ? ";show=$view" : '') . ';show_deleted=1#notes'
227 %>"><I>(<% mt('Show deleted attachments') |h %>)</I></A>
234 % if ( $view eq 'jumbo' ) {
236 <A NAME="tickets"><FONT SIZE="+2"><% mt('Tickets') |h %></FONT></A><BR>
239 % if ( $view eq 'tickets' || $view eq 'jumbo' ) {
241 % if ( $conf->config('ticket_system') ) {
242 <& cust_main/tickets.html, $cust_main &>
248 % if ( $view eq 'jumbo' ) { #XXX enable me && $curuser->access_right('View customer packages') {
250 <A NAME="cust_pkg"><FONT SIZE="+2"><% mt('Packages') |h %></FONT></A><BR>
253 % if ( $view eq 'packages' || $view eq 'jumbo' ) {
255 % #XXX enable me# if ( $curuser->access_right('View customer packages') {
256 <& cust_main/packages.html, $cust_main &>
261 % if ( $view eq 'jumbo' ) {
263 <A NAME="history"><FONT SIZE="+2"><% mt('Payment History') |h %></FONT></A>
267 % if ( $view eq 'payment_history' || $view eq 'jumbo' ) {
269 % if ( $conf->config('payby-default') ne 'HIDE' ) {
270 <& cust_main/payment_history.html, $cust_main &>
275 % if ( $view eq 'change_history' ) { # || $view eq 'jumbo'
276 <& cust_main/change_history.html, $cust_main &>
279 % if ( $view eq 'custom' ) {
280 <& cust_main/custom.html, $cust_main &>
284 <& /elements/footer.html &>
287 my $curuser = $FS::CurrentUser::CurrentUser;
290 unless $curuser->access_right('View customer');
292 my $conf = new FS::Conf;
295 if ( $cgi->param('custnum') =~ /^(\d+)$/ ) {
298 die "No customer specified (bad URL)!" unless $cgi->keywords;
299 my($query) = $cgi->keywords; # needs parens with my, ->keywords returns array
304 my $cust_main = qsearchs( {
305 'table' => 'cust_main',
306 'hashref' => { 'custnum' => $custnum },
307 'extra_sql' => ' AND '. $curuser->agentnums_sql,
309 die "Customer not found!" unless $cust_main;
311 my $title = $cust_main->name;
312 $title = '('. $cust_main->display_custnum. ") $title"
313 if $conf->exists('cust_main-title-display_custnum');
314 $title = mt("Customer:")." ".$title;
316 #false laziness w/pref/pref.html and Conf.pm (cust_main-default_view)
317 tie my %views, 'Tie::IxHash',
318 emt('Basics') => 'basics',
319 emt('Notes') => 'notes', #notes and files?
321 $views{emt('Tickets')} = 'tickets'
322 if $conf->config('ticket_system');
323 $views{emt('Packages')} = 'packages';
324 $views{emt('Payment History')} = 'payment_history'
325 unless $conf->config('payby-default' eq 'HIDE');
326 $views{emt('Change History')} = 'change_history'
327 if $curuser->access_right('View customer history');
328 $views{$conf->config('cust_main-custom_title') || emt('Custom')} = 'custom'
329 if $conf->config('cust_main-custom_link');
330 $views{emt('Jumbo')} = 'jumbo';
332 my %viewname = reverse %views;
334 my $view = $cgi->param('show') || $curuser->default_customer_view;
336 my $ie_compat = $conf->config('ie-compatibility_mode');
339 $head = qq(<meta http-equiv="X-UA-Compatible" content="IE=$ie_compat" />);