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('Suspend customer')
50 % && scalar($cust_main->unsuspended_pkgs)
52 <& /elements/popup_link-cust_main.html,
53 { 'action' => $p. 'misc/suspend_cust.html',
54 'label' => emt('Suspend this customer'),
55 'actionlabel' => emt('Confirm Suspension'),
57 'cust_main' => $cust_main,
58 'width' => 616, #make room for reasons
64 % if ( $curuser->access_right('Unsuspend customer')
65 % && scalar($cust_main->suspended_pkgs)
67 <& /elements/popup_link-cust_main.html,
68 { 'action' => $p. 'misc/unsuspend_cust.html',
69 'label' => emt('Unsuspend this customer'),
70 'actionlabel' => emt('Confirm Unsuspension'),
71 #'color' => '#ff9900',
72 'cust_main' => $cust_main,
73 #'width' => 616, #make room for reasons
79 % if ( $curuser->access_right('Cancel customer')
80 % && scalar($cust_main->ncancelled_pkgs)
82 <& /elements/popup_link-cust_main.html,
83 { 'action' => $p. 'misc/cancel_cust.html',
84 'label' => emt('Cancel this customer'),
85 'actionlabel' => emt('Confirm Cancellation'),
87 'cust_main' => $cust_main,
88 'width' => 616, #make room for reasons
94 % if ( $curuser->access_right('Merge customer')
95 % and ( scalar($cust_main->ncancelled_pkgs)
96 % || $conf->exists('deletecustomers')
100 <& /elements/popup_link-cust_main.html,
101 { 'action' => $p. 'misc/merge_cust.html',
102 'label' => emt('Merge this customer'),
103 'actionlabel' => emt('Merge customer'),
104 'cust_main' => $cust_main,
111 % if ( $conf->exists('deletecustomers')
112 % && $curuser->access_right('Delete customer')
114 <A HREF="<% $p %>misc/delete-customer.cgi?<% $custnum%>"><% mt('Delete this customer') |h %></A> |
117 % unless ( $conf->exists('disable_customer_referrals') ) {
118 <A HREF="<% $p %>edit/cust_main.cgi?referral_custnum=<% $custnum %>"><% mt('Refer a new customer') |h %></A> |
119 <A HREF="<% $p %>search/cust_main.cgi?referral_custnum=<% $custnum %>"><% mt('View this customer\'s referrals') |h %></A>
125 % if ( $curuser->access_right('Billing event reports')
126 % || $curuser->access_right('View customer billing events')
129 <A HREF="<% $p %>search/cust_event.html?custnum=<% $custnum %>"><% mt('View billing events for this customer') |h %></A>
132 % my $email_link = ($cust_main->invoicing_list_emailonly) &&
133 % include('/elements/email-link.html',
134 % 'table' => 'cust_main',
135 % 'search_hash' => { 'custnum' => $custnum },
136 % 'label' => 'Email a notice to this customer',
138 % if ( $email_link and $br ) {
141 <% $email_link || '' %>
143 % if ( $conf->config('cust_main-external_links') ) {
144 <% $br++ ? ' | ' : '' %>
145 % my @links = split(/\n/, $conf->config('cust_main-external_links'));
146 % foreach my $link (@links) {
147 % $link =~ /^\s*(\S+)\s+(.*?)(\s*\(([^\)]*)\))?$/ or next;
148 % my($url, $label, $alt) = ($1, $2, $4);
149 <A HREF="<% $url.$custnum %>" ALT="<% $alt |h %>"><% $label |h %></A>
157 %my $signupurl = $conf->config('signupurl');
159 <% mt('This customer\'s signup URL:') |h %>
160 <A HREF="<% $signupurl %>?ref=<% $custnum %>"><% $signupurl %>?ref=<% $custnum %></A>
164 <A NAME="cust_main"></A>
168 <& cust_main/contacts.html, $cust_main &>
170 <TD VALIGN="top" STYLE="padding-left: 54px">
171 <& cust_main/misc.html, $cust_main &>
172 % if ( $conf->config('payby-default') ne 'HIDE' ) {
173 <BR><& cust_main/billing.html, $cust_main &>
180 <& cust_main/contacts_new.html, $cust_main &>
187 % if ( $view eq 'notes' || $view eq 'jumbo' ) {
189 %if ( $cust_main->comments =~ /[^\s\n\r]/ ) {
190 <BR><% mt('Comments') |h %>
191 <% ntable("#cccccc") %><TR><TD><% ntable("#cccccc",2) %>
193 <TD BGCOLOR="#ffffff">
194 <PRE><% encode_entities($cust_main->comments) %></PRE>
201 % my $notecount = scalar($cust_main->notes(0));
202 % if ( ! $conf->exists('cust_main-disable_notes') || $notecount) {
204 % unless ( $view eq 'notes' && $cust_main->comments !~ /[^\s\n\r]/ ) {
206 <A NAME="cust_main_note"><FONT SIZE="+2"><% mt('Notes') |h %></FONT></A><BR>
209 % if ( $curuser->access_right('Add customer note') &&
210 % ! $conf->exists('cust_main-disable_notes')
213 <& /elements/popup_link-cust_main.html,
214 'label' => emt('Add customer note'),
215 'action' => $p. 'edit/cust_main_note.cgi',
216 'actionlabel' => emt('Enter customer note'),
217 'cust_main' => $cust_main,
219 'height' => 538, #575
226 <& cust_main/notes.html, 'custnum' => $cust_main->custnum &>
231 % if(! $conf->config('disable_cust_attachment')
232 % and $curuser->access_right('Add attachment')) {
233 <& /elements/popup_link-cust_main.html,
234 'label' => emt('Attach file'),
235 'action' => $p.'edit/cust_main_attach.cgi',
236 'actionlabel' => emt('Upload file'),
237 'cust_main' => $cust_main,
242 % if( $curuser->access_right('View attachments') ) {
243 <& cust_main/attachments.html, 'custnum' => $cust_main->custnum &>
244 % if ($cgi->param('show_deleted')) {
245 <A HREF="<% $p.'view/cust_main.cgi?custnum=' . $cust_main->custnum .
246 ($view ? ";show=$view" : '') . '#notes'
247 %>"><I>(<% mt('Show active attachments') |h %>)</I></A>
249 % elsif($curuser->access_right('View deleted attachments')) {
250 <A HREF="<% $p.'view/cust_main.cgi?custnum=' . $cust_main->custnum .
251 ($view ? ";show=$view" : '') . ';show_deleted=1#notes'
252 %>"><I>(<% mt('Show deleted attachments') |h %>)</I></A>
259 % if ( $view eq 'jumbo' ) {
264 % if ( $view eq 'tickets' || $view eq 'jumbo' ) {
266 % if ( $conf->config('ticket_system') ) {
267 <& cust_main/tickets.html, $cust_main &>
273 % if ( $view eq 'jumbo' ) { #XXX enable me && $curuser->access_right('View customer packages') {
275 <A NAME="cust_pkg"><FONT SIZE="+2"><% mt('Packages') |h %></FONT></A><BR>
278 % if ( $view eq 'packages' || $view eq 'jumbo' ) {
280 % #XXX enable me# if ( $curuser->access_right('View customer packages') {
281 <& cust_main/packages.html, $cust_main &>
286 % if ( $view eq 'jumbo' ) {
288 <A NAME="history"><FONT SIZE="+2"><% mt('Payment History') |h %></FONT></A>
292 % if ( $view eq 'payment_history' || $view eq 'jumbo' ) {
294 % if ( $conf->config('payby-default') ne 'HIDE' ) {
295 <& cust_main/payment_history.html, $cust_main &>
300 % if ( $view eq 'change_history' ) { # || $view eq 'jumbo'
301 <& cust_main/change_history.html, $cust_main &>
304 % if ( $view eq 'custom' ) {
305 % if ( $conf->config('cust_main-custom_link') ) {
306 <& cust_main/custom.html, $cust_main &>
307 % } elsif ( $conf->config('cust_main-custom_content') ) {
308 <& cust_main/custom_content.html, $cust_main &>
310 % # warn "custom view without cust_main-custom_link or -custom_content?";
315 <& /elements/footer.html &>
318 my $curuser = $FS::CurrentUser::CurrentUser;
321 unless $curuser->access_right('View customer');
323 my $conf = new FS::Conf;
326 if ( $cgi->param('custnum') =~ /^(\d+)$/ ) {
329 die "No customer specified (bad URL)!" unless $cgi->keywords;
330 my($query) = $cgi->keywords; # needs parens with my, ->keywords returns array
335 my $cust_main = qsearchs( {
336 'table' => 'cust_main',
337 'hashref' => { 'custnum' => $custnum },
338 'extra_sql' => ' AND '. $curuser->agentnums_sql,
340 die "Customer not found!" unless $cust_main;
342 my $title = $cust_main->name;
343 $title = '('. $cust_main->display_custnum. ") $title"
344 if $conf->exists('cust_main-title-display_custnum');
345 $title = mt("Customer:")." ".$title;
347 #false laziness w/pref/pref.html and Conf.pm (cust_main-default_view)
348 tie my %views, 'Tie::IxHash',
349 emt('Basics') => 'basics',
350 emt('Notes') => 'notes', #notes and files?
352 $views{emt('Tickets')} = 'tickets'
353 if $conf->config('ticket_system');
354 $views{emt('Packages')} = 'packages';
355 $views{emt('Payment History')} = 'payment_history'
356 unless $conf->config('payby-default' eq 'HIDE');
357 $views{emt('Change History')} = 'change_history'
358 if $curuser->access_right('View customer history');
359 $views{$conf->config('cust_main-custom_title') || emt('Custom')} = 'custom'
360 if $conf->config('cust_main-custom_link')
361 || $conf->config('cust_main-custom_content');
362 $views{emt('Jumbo')} = 'jumbo';
364 my %viewname = reverse %views;
366 my $view = $cgi->param('show') || $curuser->default_customer_view;
368 my $ie_compat = $conf->config('ie-compatibility_mode');
371 $head = qq(<meta http-equiv="X-UA-Compatible" content="IE=$ie_compat" />);