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;
48 % if ( $view eq 'basics' || $view eq 'jumbo' ) {
50 % if ( $curuser->access_right('Edit customer') ) {
51 <A HREF="<% $p %>edit/cust_main.cgi?<% $custnum %>"><% mt('Edit this customer') |h %></A> |
54 % if ( $curuser->access_right('Suspend customer')
55 % && scalar($cust_main->unsuspended_pkgs)
57 <& /elements/popup_link-cust_main.html,
58 { 'action' => $p. 'misc/suspend_cust.html',
59 'label' => emt('Suspend this customer'),
60 'actionlabel' => emt('Confirm Suspension'),
62 'cust_main' => $cust_main,
63 'width' => 768, #make room for reasons
69 % if ( $curuser->access_right('Unsuspend customer')
70 % && scalar($cust_main->suspended_pkgs)
72 <& /elements/popup_link-cust_main.html,
73 { 'action' => $p. 'misc/unsuspend_cust.html',
74 'label' => emt('Unsuspend this customer'),
75 'actionlabel' => emt('Confirm Unsuspension'),
76 #'color' => '#ff9900',
77 'cust_main' => $cust_main,
78 #'width' => 616, #make room for reasons
84 % if ( $curuser->access_right('Cancel customer')
85 % && scalar($cust_main->ncancelled_pkgs)
87 <& /elements/popup_link-cust_main.html,
88 { 'action' => $p. 'misc/cancel_cust.html',
89 'label' => emt('Cancel this customer'),
90 'actionlabel' => emt('Confirm Cancellation'),
92 'cust_main' => $cust_main,
93 'width' => 616, #make room for reasons
99 % if ( $curuser->access_right('Merge customer')
100 % and ( scalar($cust_main->ncancelled_pkgs)
101 % # || we start supporting payment info merge again in some way
105 <& /elements/popup_link-cust_main.html,
106 { 'action' => $p. 'misc/merge_cust.html',
107 'label' => emt('Merge this customer'),
108 'actionlabel' => emt('Merge customer'),
109 'cust_main' => $cust_main,
116 % unless ( $conf->exists('disable_customer_referrals') ) {
117 <A HREF="<% $p %>edit/cust_main.cgi?referral_custnum=<% $custnum %>"><% mt('Refer a new customer') |h %></A> |
118 <A HREF="<% $p %>search/cust_main.cgi?referral_custnum=<% $custnum %>"><% mt('View this customer\'s referrals') |h %></A>
124 % if ( $curuser->access_right('Billing event reports')
125 % || $curuser->access_right('View customer billing events')
128 <A HREF="<% $p %>search/cust_event.html?custnum=<% $custnum %>"><% mt('View billing events for this customer') |h %></A>
131 % my $email_link = ($cust_main->invoicing_list_emailonly) &&
132 % include('/elements/email-link.html',
133 % 'table' => 'cust_main',
134 % 'search_hash' => { 'custnum' => $custnum },
135 % 'agent_virt_agentnum' => $cust_main->agentnum,
136 % 'label' => 'Email a notice to this customer',
138 % if ( $email_link and $br ) {
141 <% $email_link || '' %>
143 % if ( $curuser->access_right('Order customer package') && $conf->exists('cust_main-enable_order_package') ) {
144 | <& /elements/order_pkg_link.html, 'cust_main'=>$cust_main &>
147 % if ( $conf->config('cust_main-external_links') ) {
148 <% $br++ ? ' | ' : '' %>
149 % my @links = split(/\n/, $conf->config('cust_main-external_links'));
150 % foreach my $link (@links) {
151 % $link =~ /^\s*(\S+)\s+(.*?)(\s*\(([^\)]*)\))?$/ or next;
152 % my($url, $label, $alt) = ($1, $2, $4);
153 <A HREF="<% $url.$custnum %>" ALT="<% $alt |h %>"><% $label |h %></A>
161 %my $signupurl = $conf->config('signupurl');
163 <% mt('This customer\'s signup URL:') |h %>
164 <A HREF="<% $signupurl %>?ref=<% $custnum %>"><% $signupurl %>?ref=<% $custnum %></A>
168 <A NAME="cust_main"></A>
172 <& cust_main/misc.html, $cust_main &>
173 <BR><& cust_main/contacts.html, $cust_main &>
175 <TD VALIGN="top" STYLE="padding-left: 54px">
176 <& cust_main/billing.html, $cust_main &>
177 <BR><& cust_main/cust_payby.html, $cust_main &>
182 <& cust_main/contacts_new.html, $cust_main &>
194 % if ( $view eq 'notes' || $view eq 'jumbo' ) {
196 <& cust_main/notes.html, 'cust_main' => $cust_main &>
200 % if ( $view eq 'jumbo' ) {
211 % if ( $view eq 'tickets' || $view eq 'jumbo' ) {
213 % if ( $conf->config('ticket_system') ) {
214 <& cust_main/tickets.html, $cust_main &>
224 % if ( $view eq 'appointments' || $view eq 'jumbo' ) {
226 % if ( $conf->config('ticket_system')
227 % && $curuser->access_right('View appointments') ) {
228 <& cust_main/appointments.html, $cust_main &>
239 % if ( $view eq 'jumbo' && $curuser->access_right('Generate quotation') ) {
240 <A NAME="quotations"><FONT SIZE="+2"><% mt('Quotations') |h %></FONT></A><BR>
243 % if ( $view eq 'quotations' || $view eq 'jumbo' ) {
245 % if ( $curuser->access_right('Generate quotation') ) {
246 <& cust_main/quotations.html, $cust_main &>
256 % if ( $view eq 'jumbo' ) { #XXX enable me && $curuser->access_right('View customer packages') {
258 <A NAME="cust_pkg"><FONT SIZE="+2"><% mt('Packages') |h %></FONT></A><BR>
261 % if ( $view eq 'packages' || $view eq 'jumbo' ) {
263 % #XXX enable me# if ( $curuser->access_right('View customer packages') {
264 <& cust_main/packages.html, $cust_main &>
274 % if ( $view eq 'jumbo' ) {
276 <A NAME="history"><FONT SIZE="+2"><% mt('Payment History') |h %></FONT></A>
280 % if ( $view eq 'payment_history' || $view eq 'jumbo' ) {
282 <& cust_main/payment_history.html, $cust_main &>
291 % if ( $view eq 'change_history' ) { # || $view eq 'jumbo'
292 <& cust_main/change_history.html, $cust_main &>
295 % if ( $view eq 'custom' ) {
296 % if ( $conf->config('cust_main-custom_link') ) {
297 <& cust_main/custom.html, $cust_main &>
298 % } elsif ( $conf->config('cust_main-custom_content') ) {
299 <& cust_main/custom_content.html, $cust_main &>
301 % # warn "custom view without cust_main-custom_link or -custom_content?";
306 <& /elements/footer.html &>
309 my $curuser = $FS::CurrentUser::CurrentUser;
312 unless $curuser->access_right('View customer');
314 my $conf = new FS::Conf;
317 if ( $cgi->param('custnum') =~ /^(\d+)$/ ) {
320 die "No customer specified (bad URL)!" unless $cgi->keywords;
321 my($query) = $cgi->keywords; # needs parens with my, ->keywords returns array
324 $cgi->param('custnum', $1);
327 my $cust_main = qsearchs( {
328 'table' => 'cust_main',
329 'hashref' => { 'custnum' => $custnum },
330 'extra_sql' => ' AND '. $curuser->agentnums_sql,
332 die "Customer not found!" unless $cust_main;
334 my $title = $cust_main->name;
335 $title = '('. $cust_main->display_custnum. ") $title"
336 if $conf->exists('cust_main-title-display_custnum');
337 $title = mt("Customer:")." ".$title;
339 #false laziness w/pref/pref.html and Conf.pm (cust_main-default_view)
340 tie my %views, 'Tie::IxHash',
341 emt('Basics') => 'basics',
342 emt('Notes') => 'notes', #notes and files?
344 if ( $conf->config('ticket_system') ) {
345 $views{emt('Tickets')} = 'tickets';
346 $views{emt('Appointments')} = 'appointments'
347 if $curuser->access_right('View appointments');
349 $views{emt('Quotations')} = 'quotations';
350 $views{emt('Packages')} = 'packages';
351 $views{emt('Payment History')} = 'payment_history';
352 $views{emt('Change History')} = 'change_history'
353 if $curuser->access_right('View customer history');
354 $views{$conf->config('cust_main-custom_title') || emt('Custom')} = 'custom'
355 if $conf->config('cust_main-custom_link')
356 || $conf->config('cust_main-custom_content');
357 $views{emt('Jumbo')} = 'jumbo';
359 my %viewname = reverse %views;
361 my $view = $cgi->param('show') || $curuser->default_customer_view;
363 my $ie_compat = $conf->config('ie-compatibility_mode');
366 $head = qq(<meta http-equiv="X-UA-Compatible" content="IE=$ie_compat" />);