1 <& /elements/header.html, {
3 'title_noescape' => $title_noescape,
9 % my @part_tag = $cust_main->part_tag;
10 % if ( $conf->config('cust_tag-location') eq 'top' && @part_tag ) {
11 <TABLE STYLE="margin-bottom:8px" CELLSPACING=2>
12 % foreach my $part_tag ( @part_tag ) {
16 <% length($part_tag->tagcolor)
17 ? 'STYLE="background-color:#'.$part_tag->tagcolor.'"'
19 %>><% $part_tag->tagname.': '. $part_tag->tagdesc |h %></FONT>
26 <& /elements/menubar.html,
28 'selected' => $viewname{$view},
29 'url_base' => $cgi->url. "?custnum=$custnum;show=",
33 <DIV CLASS="fstabcontainer">
35 <& /elements/init_overlib.html &>
37 <SCRIPT TYPE="text/javascript">
38 function areyousure(href, message) {
39 if (confirm(message) == true)
40 window.location.href = href;
49 % if ( $view eq 'basics' || $view eq 'jumbo' ) {
51 % if ( $curuser->access_right('Edit customer') ) {
52 <A HREF="<% $p %>edit/cust_main.cgi?<% $custnum %>"><% mt('Edit this customer') |h %></A> |
55 % if ( $curuser->access_right('Suspend customer')
56 % && scalar($cust_main->unsuspended_pkgs)
58 <& /elements/popup_link-cust_main.html,
59 { 'action' => $p. 'misc/suspend_cust.html',
60 'label' => emt('Suspend this customer'),
61 'actionlabel' => emt('Confirm Suspension'),
63 'cust_main' => $cust_main,
64 'width' => 768, #make room for reasons
70 % if ( $curuser->access_right('Unsuspend customer')
71 % && scalar($cust_main->suspended_pkgs)
73 <& /elements/popup_link-cust_main.html,
74 { 'action' => $p. 'misc/unsuspend_cust.html',
75 'label' => emt('Unsuspend this customer'),
76 'actionlabel' => emt('Confirm Unsuspension'),
77 #'color' => '#ff9900',
78 'cust_main' => $cust_main,
79 #'width' => 616, #make room for reasons
85 % if ( $curuser->access_right('Cancel customer')
86 % && scalar($cust_main->ncancelled_pkgs)
88 <& /elements/popup_link-cust_main.html,
89 { 'action' => $p. 'misc/cancel_cust.html',
90 'label' => emt('Cancel this customer'),
91 'actionlabel' => emt('Confirm Cancellation'),
93 'cust_main' => $cust_main,
94 'width' => 616, #make room for reasons
100 % if ( $curuser->access_right('Merge customer')
101 % and ( scalar($cust_main->ncancelled_pkgs)
102 % # || we start supporting payment info merge again in some way
106 <& /elements/popup_link-cust_main.html,
107 { 'action' => $p. 'misc/merge_cust.html',
108 'label' => emt('Merge this customer'),
109 'actionlabel' => emt('Merge customer'),
110 'cust_main' => $cust_main,
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 % 'agent_virt_agentnum' => $cust_main->agentnum,
137 % 'label' => 'Email a notice to this customer',
139 % if ( $email_link and $br ) {
142 <% $email_link || '' %>
144 % if ( $curuser->access_right('Order customer package') && $conf->exists('cust_main-enable_order_package') ) {
145 | <& /elements/order_pkg_link.html, 'cust_main'=>$cust_main &>
148 % if ( $conf->config('cust_main-external_links') ) {
149 <% $br++ ? ' | ' : '' %>
150 % my @links = split(/\n/, $conf->config('cust_main-external_links'));
151 % foreach my $link (@links) {
152 % $link =~ /^\s*(\S+)\s+(.*?)(\s*\(([^\)]*)\))?$/ or next;
153 % my($url, $label, $alt) = ($1, $2, $4);
154 <A HREF="<% $url.$custnum %>" ALT="<% $alt |h %>"><% $label |h %></A>
162 %my $signupurl = $conf->config('signupurl');
164 <% mt('This customer\'s signup URL:') |h %>
165 <A HREF="<% $signupurl %>?ref=<% $custnum %>"><% $signupurl %>?ref=<% $custnum %></A>
169 <A NAME="cust_main"></A>
173 <& cust_main/contacts.html, $cust_main &>
175 <& cust_main/misc.html, $cust_main &>
177 <TD VALIGN="top" STYLE="padding-left: 54px">
178 <& cust_main/billing.html, $cust_main &>
180 <& cust_main/cust_payby.html, $cust_main &>
185 <& cust_main/contacts_new.html, $cust_main &>
197 % if ( $view eq 'notes' || $view eq 'jumbo' ) {
199 <& cust_main/notes.html, 'cust_main' => $cust_main &>
203 % if ( $view eq 'jumbo' ) {
214 % if ( $view eq 'tickets' || $view eq 'jumbo' ) {
216 % if ( $conf->config('ticket_system') ) {
217 <& cust_main/tickets.html, $cust_main &>
227 % if ( $view eq 'appointments' || $view eq 'jumbo' ) {
229 % if ( $conf->config('ticket_system')
230 % && $curuser->access_right('View appointments') ) {
231 <& cust_main/appointments.html, $cust_main &>
242 % if ( $view eq 'jumbo' && $curuser->access_right('Generate quotation') ) {
243 <A NAME="quotations"><FONT SIZE="+2"><% mt('Quotations') |h %></FONT></A><BR>
246 % if ( $view eq 'quotations' || $view eq 'jumbo' ) {
248 % if ( $curuser->access_right('Generate quotation') ) {
249 <& cust_main/quotations.html, $cust_main &>
259 % if ( $view eq 'jumbo' ) { #XXX enable me && $curuser->access_right('View customer packages') {
261 <A NAME="cust_pkg"><FONT SIZE="+2"><% mt('Packages') |h %></FONT></A><BR>
264 % if ( $view eq 'packages' || $view eq 'jumbo' ) {
266 % #XXX enable me# if ( $curuser->access_right('View customer packages') {
267 <& cust_main/packages.html, $cust_main &>
277 % if ( $view eq 'jumbo' ) {
279 <A NAME="history"><FONT SIZE="+2"><% mt('Payment History') |h %></FONT></A>
283 % if ( $view eq 'payment_history' || $view eq 'jumbo' ) {
285 <& cust_main/payment_history.html, $cust_main &>
294 % if ( $view eq 'change_history' ) { # || $view eq 'jumbo'
295 <& cust_main/change_history.html, $cust_main &>
298 % if ( $view eq 'custom' ) {
299 % if ( $conf->config('cust_main-custom_link') ) {
300 <& cust_main/custom.html, $cust_main &>
301 % } elsif ( $conf->config('cust_main-custom_content') ) {
302 <& cust_main/custom_content.html, $cust_main &>
304 % # warn "custom view without cust_main-custom_link or -custom_content?";
309 <& /elements/footer.html &>
312 my $curuser = $FS::CurrentUser::CurrentUser;
315 unless $curuser->access_right('View customer');
317 my $conf = new FS::Conf;
320 if ( $cgi->param('custnum') =~ /^(\d+)$/ ) {
323 die "No customer specified (bad URL)!" unless $cgi->keywords;
324 my($query) = $cgi->keywords; # needs parens with my, ->keywords returns array
327 $cgi->param('custnum', $1);
330 my $cust_main = qsearchs( {
331 'table' => 'cust_main',
332 'hashref' => { 'custnum' => $custnum },
333 'extra_sql' => ' AND '. $curuser->agentnums_sql,
335 die "Customer not found!" unless $cust_main;
337 my $title = encode_entities($cust_main->name);
338 $title = '#'. $cust_main->display_custnum. " $title";
339 # if $conf->exists('cust_main-title-display_custnum');
340 $title = mt("Customer")." ".$title;
342 my @agentnums = $curuser->agentnums;
343 if (scalar(@agentnums) > 1 ) {
344 $title = encode_entities($cust_main->agent->agent). " $title";
347 my $status = $cust_main->status_label;
348 $status .= ' (Cancelled)' if $cust_main->is_status_delay_cancel;
349 my $title_noescape = $title. ' (<B><FONT COLOR="#'. $cust_main->statuscolor. '">'. $status. '</FONT></B>)';
350 $title .= " ($status)";
352 #false laziness w/pref/pref.html and Conf.pm (cust_main-default_view)
353 tie my %views, 'Tie::IxHash',
354 emt('Basics') => 'basics',
355 emt('Notes') => 'notes', #notes and files?
357 if ( $conf->config('ticket_system') ) {
358 $views{emt('Tickets')} = 'tickets';
359 $views{emt('Appointments')} = 'appointments'
360 if $curuser->access_right('View appointments');
362 $views{emt('Quotations')} = 'quotations';
363 $views{emt('Packages')} = 'packages';
364 $views{emt('Payment History')} = 'payment_history';
365 $views{emt('Change History')} = 'change_history'
366 if $curuser->access_right('View customer history');
367 $views{$conf->config('cust_main-custom_title') || emt('Custom')} = 'custom'
368 if $conf->config('cust_main-custom_link')
369 || $conf->config('cust_main-custom_content');
370 $views{emt('Jumbo')} = 'jumbo';
372 my %viewname = reverse %views;
374 my $view = $cgi->param('show') || $curuser->default_customer_view;
376 my $ie_compat = $conf->config('ie-compatibility_mode');
379 $head = qq(<meta http-equiv="X-UA-Compatible" content="IE=$ie_compat" />);