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;
41 function areyousure_popup(message, action, actionlabel) {
42 if (confirm(message) == true) {
43 <% include('/elements/popup_link_onclick.html',
44 'js_action' => 'action',
45 'js_actionlabel' => 'actionlabel',
56 % if ( $view eq 'basics' || $view eq 'jumbo' ) {
58 % if ( $curuser->access_right('Edit customer') ) {
59 <A HREF="<% $p %>edit/cust_main.cgi?<% $custnum %>"><% mt('Edit this customer') |h %></A> |
62 % if ( $curuser->access_right('Suspend customer')
63 % && scalar($cust_main->unsuspended_pkgs)
65 <& /elements/popup_link-cust_main.html,
66 { 'action' => $p. 'misc/suspend_cust.html',
67 'label' => emt('Suspend this customer'),
68 'actionlabel' => emt('Confirm Suspension'),
70 'cust_main' => $cust_main,
71 'width' => 768, #make room for reasons
77 % if ( $curuser->access_right('Unsuspend customer')
78 % && scalar($cust_main->suspended_pkgs)
80 <& /elements/popup_link-cust_main.html,
81 { 'action' => $p. 'misc/unsuspend_cust.html',
82 'label' => emt('Unsuspend this customer'),
83 'actionlabel' => emt('Confirm Unsuspension'),
84 #'color' => '#ff9900',
85 'cust_main' => $cust_main,
86 #'width' => 616, #make room for reasons
92 % if ( $curuser->access_right('Cancel customer')
93 % && scalar($cust_main->ncancelled_pkgs)
95 <& /elements/popup_link-cust_main.html,
96 { 'action' => $p. 'misc/cancel_cust.html',
97 'label' => emt('Cancel this customer'),
98 'actionlabel' => emt('Confirm Cancellation'),
100 'cust_main' => $cust_main,
101 'width' => 616, #make room for reasons
107 % if ( $curuser->access_right('Merge customer')
108 % and ( scalar($cust_main->ncancelled_pkgs)
109 % || $conf->exists('deletecustomers')
113 <& /elements/popup_link-cust_main.html,
114 { 'action' => $p. 'misc/merge_cust.html',
115 'label' => emt('Merge this customer'),
116 'actionlabel' => emt('Merge customer'),
117 'cust_main' => $cust_main,
124 % if ( $conf->exists('deletecustomers')
125 % && $curuser->access_right('Delete customer')
127 <A HREF="<% $p %>misc/delete-customer.cgi?<% $custnum%>"><% mt('Delete this customer') |h %></A> |
130 % unless ( $conf->exists('disable_customer_referrals') ) {
131 <A HREF="<% $p %>edit/cust_main.cgi?referral_custnum=<% $custnum %>"><% mt('Refer a new customer') |h %></A> |
132 <A HREF="<% $p %>search/cust_main.cgi?referral_custnum=<% $custnum %>"><% mt('View this customer\'s referrals') |h %></A>
138 % if ( $curuser->access_right('Billing event reports')
139 % || $curuser->access_right('View customer billing events')
142 <A HREF="<% $p %>search/cust_event.html?custnum=<% $custnum %>"><% mt('View billing events for this customer') |h %></A>
144 % if ( $curuser->access_right('Configuration') ) {
145 <% $br++ ? ' | ' : '' %>
146 <A HREF="<% $p %>misc/test-part_event.html?custnum=<% $custnum %>"><% mt('Test billing events for this customer') |h %></A>
149 % my $email_link = ($cust_main->invoicing_list_emailonly) &&
150 % include('/elements/email-link.html',
151 % 'table' => 'cust_main',
152 % 'search_hash' => { 'custnum' => $custnum },
153 % 'agent_virt_agentnum' => $cust_main->agentnum,
154 % 'label' => 'Email a notice to this customer',
156 % if ( $email_link and $br ) {
159 <% $email_link || '' %>
161 % if ( $curuser->access_right('Order customer package') && $conf->exists('cust_main-enable_order_package') ) {
162 | <& /elements/order_pkg_link.html, 'cust_main'=>$cust_main &>
165 % if ( $conf->config('cust_main-external_links') ) {
166 <% $br++ ? ' | ' : '' %>
167 % my @links = split(/\n/, $conf->config('cust_main-external_links'));
168 % foreach my $link (@links) {
169 % $link =~ /^\s*(\S+)\s+(.*?)(\s*\(([^\)]*)\))?$/ or next;
170 % my($url, $label, $alt) = ($1, $2, $4);
171 <A HREF="<% $url.$custnum %>" ALT="<% $alt |h %>"><% $label |h %></A>
179 %my $signupurl = $conf->config('signupurl');
181 <% mt('This customer\'s signup URL:') |h %>
182 <A HREF="<% $signupurl %>?ref=<% $custnum %>"><% $signupurl %>?ref=<% $custnum %></A>
186 <A NAME="cust_main"></A>
190 <& cust_main/contacts.html, $cust_main &>
192 <TD VALIGN="top" STYLE="padding-left: 54px">
193 <& cust_main/misc.html, $cust_main &>
194 % if ( $conf->config('payby-default') ne 'HIDE' ) {
195 <BR><& cust_main/billing.html, $cust_main &>
202 <& cust_main/contacts_new.html, $cust_main &>
214 % if ( $view eq 'notes' || $view eq 'jumbo' ) {
216 <& cust_main/notes.html, 'cust_main' => $cust_main &>
220 % if ( $view eq 'jumbo' ) {
231 % if ( $view eq 'tickets' || $view eq 'jumbo' ) {
233 % if ( $conf->config('ticket_system') ) {
234 <& cust_main/tickets.html, $cust_main &>
244 % if ( $view eq 'appointments' || $view eq 'jumbo' ) {
246 % if ( $conf->config('ticket_system')
247 % && $curuser->access_right('View appointments') ) {
248 <& cust_main/appointments.html, $cust_main &>
259 % if ( $view eq 'jumbo' && $curuser->access_right('Generate quotation') ) {
260 <A NAME="quotations"><FONT SIZE="+2"><% mt('Quotations') |h %></FONT></A><BR>
263 % if ( $view eq 'quotations' || $view eq 'jumbo' ) {
265 % if ( $curuser->access_right('Generate quotation') ) {
266 <& cust_main/quotations.html, $cust_main &>
276 % if ( $view eq 'jumbo' ) { #XXX enable me && $curuser->access_right('View customer packages') {
278 <A NAME="cust_pkg"><FONT SIZE="+2"><% mt('Packages') |h %></FONT></A><BR>
281 % if ( $view eq 'packages' || $view eq 'jumbo' ) {
283 % #XXX enable me# if ( $curuser->access_right('View customer packages') {
284 <& cust_main/packages.html, $cust_main &>
294 % if ( $view eq 'jumbo' ) {
296 <A NAME="history"><FONT SIZE="+2"><% mt('Payment History') |h %></FONT></A>
300 % if ( $view eq 'payment_history' || $view eq 'jumbo' ) {
302 % if ( $conf->config('payby-default') ne 'HIDE' ) {
303 <& cust_main/payment_history.html, $cust_main &>
313 % if ( $view eq 'change_history' ) { # || $view eq 'jumbo'
314 <& cust_main/change_history.html, $cust_main &>
317 % if ( $view eq 'custom' ) {
318 % if ( $conf->config('cust_main-custom_link') ) {
319 <& cust_main/custom.html, $cust_main &>
320 % } elsif ( $conf->config('cust_main-custom_content') ) {
321 <& cust_main/custom_content.html, $cust_main &>
323 % # warn "custom view without cust_main-custom_link or -custom_content?";
328 <& /elements/footer.html &>
331 my $curuser = $FS::CurrentUser::CurrentUser;
334 unless $curuser->access_right('View customer');
336 my $conf = new FS::Conf;
339 if ( $cgi->param('custnum') =~ /^(\d+)$/ ) {
342 die "No customer specified (bad URL)!" unless $cgi->keywords;
343 my($query) = $cgi->keywords; # needs parens with my, ->keywords returns array
346 $cgi->param('custnum', $1);
349 my $cust_main = qsearchs( {
350 'table' => 'cust_main',
351 'hashref' => { 'custnum' => $custnum },
352 'extra_sql' => ' AND '. $curuser->agentnums_sql,
354 die "Customer not found!" unless $cust_main;
356 my $title = $cust_main->name;
357 $title = '('. $cust_main->display_custnum. ") $title"
358 if $conf->exists('cust_main-title-display_custnum');
359 $title = mt("Customer:")." ".$title;
361 #false laziness w/pref/pref.html and Conf.pm (cust_main-default_view)
362 tie my %views, 'Tie::IxHash',
363 emt('Basics') => 'basics',
364 emt('Notes') => 'notes', #notes and files?
366 if ( $conf->config('ticket_system') ) {
367 $views{emt('Tickets')} = 'tickets';
368 $views{emt('Appointments')} = 'appointments'
369 if $curuser->access_right('View appointments');
371 $views{emt('Quotations')} = 'quotations';
372 $views{emt('Packages')} = 'packages';
373 $views{emt('Payment History')} = 'payment_history'
374 unless $conf->config('payby-default' eq 'HIDE');
375 $views{emt('Change History')} = 'change_history'
376 if $curuser->access_right('View customer history');
377 $views{$conf->config('cust_main-custom_title') || emt('Custom')} = 'custom'
378 if $conf->config('cust_main-custom_link')
379 || $conf->config('cust_main-custom_content');
380 $views{emt('Jumbo')} = 'jumbo';
382 my %viewname = reverse %views;
384 my $view = $cgi->param('show') || $curuser->default_customer_view;
386 my $ie_compat = $conf->config('ie-compatibility_mode');
389 $head = qq(<meta http-equiv="X-UA-Compatible" content="IE=$ie_compat" />);