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' => 616, #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 % || $conf->exists('deletecustomers')
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 % if ( $conf->exists('deletecustomers')
117 % && $curuser->access_right('Delete customer')
119 <A HREF="<% $p %>misc/delete-customer.cgi?<% $custnum%>"><% mt('Delete this customer') |h %></A> |
122 % unless ( $conf->exists('disable_customer_referrals') ) {
123 <A HREF="<% $p %>edit/cust_main.cgi?referral_custnum=<% $custnum %>"><% mt('Refer a new customer') |h %></A> |
124 <A HREF="<% $p %>search/cust_main.cgi?referral_custnum=<% $custnum %>"><% mt('View this customer\'s referrals') |h %></A>
130 % if ( $curuser->access_right('Billing event reports')
131 % || $curuser->access_right('View customer billing events')
134 <A HREF="<% $p %>search/cust_event.html?custnum=<% $custnum %>"><% mt('View billing events for this customer') |h %></A>
137 % my $email_link = ($cust_main->invoicing_list_emailonly) &&
138 % include('/elements/email-link.html',
139 % 'table' => 'cust_main',
140 % 'search_hash' => { 'custnum' => $custnum },
141 % 'agent_virt_agentnum' => $cust_main->agentnum,
142 % 'label' => 'Email a notice to this customer',
144 % if ( $email_link and $br ) {
147 <% $email_link || '' %>
149 % if ( $curuser->access_right('Order customer package') && $conf->exists('cust_main-enable_order_package') ) {
150 | <& /elements/order_pkg_link.html, 'cust_main'=>$cust_main &>
153 % if ( $conf->config('cust_main-external_links') ) {
154 <% $br++ ? ' | ' : '' %>
155 % my @links = split(/\n/, $conf->config('cust_main-external_links'));
156 % foreach my $link (@links) {
157 % $link =~ /^\s*(\S+)\s+(.*?)(\s*\(([^\)]*)\))?$/ or next;
158 % my($url, $label, $alt) = ($1, $2, $4);
159 <A HREF="<% $url.$custnum %>" ALT="<% $alt |h %>"><% $label |h %></A>
167 %my $signupurl = $conf->config('signupurl');
169 <% mt('This customer\'s signup URL:') |h %>
170 <A HREF="<% $signupurl %>?ref=<% $custnum %>"><% $signupurl %>?ref=<% $custnum %></A>
174 <A NAME="cust_main"></A>
178 <& cust_main/contacts.html, $cust_main &>
180 <TD VALIGN="top" STYLE="padding-left: 54px">
181 <& cust_main/misc.html, $cust_main &>
182 % if ( $conf->config('payby-default') ne 'HIDE' ) {
183 <BR><& cust_main/billing.html, $cust_main &>
190 <& cust_main/contacts_new.html, $cust_main &>
202 % if ( $view eq 'notes' || $view eq 'jumbo' ) {
204 <& cust_main/notes.html, 'cust_main' => $cust_main &>
208 % if ( $view eq 'jumbo' ) {
219 % if ( $view eq 'tickets' || $view eq 'jumbo' ) {
221 % if ( $conf->config('ticket_system') ) {
222 <& cust_main/tickets.html, $cust_main &>
232 % if ( $view eq 'appointments' || $view eq 'jumbo' ) {
234 % if ( $conf->config('ticket_system')
235 % && $curuser->access_right('View appointments') ) {
236 <& cust_main/appointments.html, $cust_main &>
247 % if ( $view eq 'jumbo' && $curuser->access_right('Generate quotation') ) {
248 <A NAME="quotation"><FONT SIZE="+2"><% mt('Quotations') |h %></FONT></A><BR>
251 % if ( $view eq 'quotations' || $view eq 'jumbo' ) {
253 % if ( $curuser->access_right('Generate quotation') ) {
254 <& cust_main/quotations.html, $cust_main &>
264 % if ( $view eq 'jumbo' ) { #XXX enable me && $curuser->access_right('View customer packages') {
266 <A NAME="cust_pkg"><FONT SIZE="+2"><% mt('Packages') |h %></FONT></A><BR>
269 % if ( $view eq 'packages' || $view eq 'jumbo' ) {
271 % #XXX enable me# if ( $curuser->access_right('View customer packages') {
272 <& cust_main/packages.html, $cust_main &>
282 % if ( $view eq 'jumbo' ) {
284 <A NAME="history"><FONT SIZE="+2"><% mt('Payment History') |h %></FONT></A>
288 % if ( $view eq 'payment_history' || $view eq 'jumbo' ) {
290 % if ( $conf->config('payby-default') ne 'HIDE' ) {
291 <& cust_main/payment_history.html, $cust_main &>
301 % if ( $view eq 'change_history' ) { # || $view eq 'jumbo'
302 <& cust_main/change_history.html, $cust_main &>
305 % if ( $view eq 'custom' ) {
306 % if ( $conf->config('cust_main-custom_link') ) {
307 <& cust_main/custom.html, $cust_main &>
308 % } elsif ( $conf->config('cust_main-custom_content') ) {
309 <& cust_main/custom_content.html, $cust_main &>
311 % # warn "custom view without cust_main-custom_link or -custom_content?";
316 <& /elements/footer.html &>
319 my $curuser = $FS::CurrentUser::CurrentUser;
322 unless $curuser->access_right('View customer');
324 my $conf = new FS::Conf;
327 if ( $cgi->param('custnum') =~ /^(\d+)$/ ) {
330 die "No customer specified (bad URL)!" unless $cgi->keywords;
331 my($query) = $cgi->keywords; # needs parens with my, ->keywords returns array
334 $cgi->param('custnum', $1);
337 my $cust_main = qsearchs( {
338 'table' => 'cust_main',
339 'hashref' => { 'custnum' => $custnum },
340 'extra_sql' => ' AND '. $curuser->agentnums_sql,
342 die "Customer not found!" unless $cust_main;
344 my $title = $cust_main->name;
345 $title = '('. $cust_main->display_custnum. ") $title"
346 if $conf->exists('cust_main-title-display_custnum');
347 $title = mt("Customer:")." ".$title;
349 #false laziness w/pref/pref.html and Conf.pm (cust_main-default_view)
350 tie my %views, 'Tie::IxHash',
351 emt('Basics') => 'basics',
352 emt('Notes') => 'notes', #notes and files?
354 if ( $conf->config('ticket_system') ) {
355 $views{emt('Tickets')} = 'tickets';
356 $views{emt('Appointments')} = 'appointments'
357 if $curuser->access_right('View appointments');
359 $views{emt('Quotations')} = 'quotations';
360 $views{emt('Packages')} = 'packages';
361 $views{emt('Payment History')} = 'payment_history'
362 unless $conf->config('payby-default' eq 'HIDE');
363 $views{emt('Change History')} = 'change_history'
364 if $curuser->access_right('View customer history');
365 $views{$conf->config('cust_main-custom_title') || emt('Custom')} = 'custom'
366 if $conf->config('cust_main-custom_link')
367 || $conf->config('cust_main-custom_content');
368 $views{emt('Jumbo')} = 'jumbo';
370 my %viewname = reverse %views;
372 my $view = $cgi->param('show') || $curuser->default_customer_view;
374 my $ie_compat = $conf->config('ie-compatibility_mode');
377 $head = qq(<meta http-equiv="X-UA-Compatible" content="IE=$ie_compat" />);