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 <& cust_main/menu.html, cust_main => $cust_main, show => $view &>
29 <DIV CLASS="fstabcontainer">
31 <& /elements/init_overlib.html &>
33 <SCRIPT TYPE="text/javascript">
34 function areyousure(href, message) {
35 if (confirm(message) == true)
36 window.location.href = href;
46 % if ( $view eq 'basics' ) {
49 % if ( $curuser->access_right('Order customer package') && $conf->exists('cust_main-enable_order_package') ) {
50 | <& /elements/order_pkg_link.html, 'cust_main'=>$cust_main &>
53 % if ( $conf->config('cust_main-external_links') ) {
54 <% $br++ ? ' | ' : '' %>
55 % my @links = split(/\n/, $conf->config('cust_main-external_links'));
56 % foreach my $link (@links) {
57 % $link =~ /^\s*(\S+)\s+(.*?)(\s*\(([^\)]*)\))?$/ or next;
58 % my($url, $label, $alt) = ($1, $2, $4);
59 <A HREF="<% $url.$custnum %>" ALT="<% $alt |h %>"><% $label |h %></A>
67 %my $signupurl = $conf->config('signupurl');
69 <% mt('This customer\'s signup URL:') |h %>
70 <A HREF="<% $signupurl %>?ref=<% $custnum %>"><% $signupurl %>?ref=<% $custnum %></A>
77 <& cust_main/contacts.html, $cust_main &>
79 <& cust_main/misc.html, $cust_main &>
81 <TD VALIGN="top" STYLE="padding-left: 54px">
82 <& cust_main/billing.html, $cust_main &>
84 <& cust_main/cust_payby.html, $cust_main &>
89 <& cust_main/contacts_new.html, $cust_main &>
101 % if ( $view eq 'notes' ) {
102 <& cust_main/notes.html, 'cust_main' => $cust_main &>
111 % if ( $view eq 'tickets' ) {
113 % if ( $conf->config('ticket_system') ) {
114 <& cust_main/tickets.html, $cust_main &>
124 % if ( $view eq 'appointments' ) {
126 % if ( $conf->config('ticket_system')
127 % && $curuser->access_right('View appointments') ) {
128 <& cust_main/appointments.html, $cust_main &>
139 % if ( $view eq 'quotations' ) {
141 % if ( $curuser->access_right('Generate quotation') ) {
142 <& cust_main/quotations.html, $cust_main &>
152 % if ( $view eq 'packages' ) {
154 % #XXX enable me# if ( $curuser->access_right('View customer packages') {
155 <& cust_main/packages.html, $cust_main &>
166 % if ( $view eq 'payment_history' ) {
168 <& cust_main/payment_history.html, $cust_main &>
178 % if ( $view eq 'change_history' ) {
179 <& cust_main/change_history.html, $cust_main &>
183 % if ( $view eq 'custom' ) {
184 % if ( $conf->config('cust_main-custom_link') ) {
185 <& cust_main/custom.html, $cust_main &>
186 % } elsif ( $conf->config('cust_main-custom_content') ) {
187 <& cust_main/custom_content.html, $cust_main &>
189 % # warn "custom view without cust_main-custom_link or -custom_content?";
194 <& /elements/footer.html &>
197 my $curuser = $FS::CurrentUser::CurrentUser;
200 unless $curuser->access_right('View customer');
202 my $conf = new FS::Conf;
205 if ( $cgi->param('custnum') =~ /^(\d+)$/ ) {
208 die "No customer specified (bad URL)!" unless $cgi->keywords;
209 my($query) = $cgi->keywords; # needs parens with my, ->keywords returns array
212 $cgi->delete('keywords');
213 $cgi->param('custnum', $1);
216 my $cust_main = qsearchs( {
217 'table' => 'cust_main',
218 'hashref' => { 'custnum' => $custnum },
219 'extra_sql' => ' AND '. $curuser->agentnums_sql,
221 die "Customer not found!" unless $cust_main;
223 my $title = encode_entities($cust_main->name);
224 $title = '#'. $cust_main->display_custnum. " $title";
225 # if $conf->exists('cust_main-title-display_custnum');
226 $title = mt("Customer")." ".$title;
228 my @agentnums = $curuser->agentnums;
229 if (scalar(@agentnums) > 1 ) {
230 $title = encode_entities($cust_main->agent->agent). " $title";
233 my $status = $cust_main->status_label;
234 $status .= ' (Cancelled)' if $cust_main->is_status_delay_cancel;
235 my $title_noescape = $title. ' (<B><FONT COLOR="#'. $cust_main->statuscolor. '">'. $status. '</FONT></B>)';
236 $title .= " ($status)";
238 #false laziness w/pref/pref.html and Conf.pm (cust_main-default_view)
239 tie my %views, 'Tie::IxHash',
240 emt('Basics') => 'basics',
241 emt('Notes') => 'notes', #notes and files?
243 if ( $conf->config('ticket_system') ) {
244 $views{emt('Tickets')} = 'tickets';
245 $views{emt('Appointments')} = 'appointments'
246 if $curuser->access_right('View appointments');
248 $views{emt('Quotations')} = 'quotations';
249 $views{emt('Packages')} = 'packages';
250 $views{emt('Payment History')} = 'payment_history';
251 $views{emt('Change History')} = 'change_history'
252 if $curuser->access_right('View customer history');
253 $views{$conf->config('cust_main-custom_title') || emt('Custom')} = 'custom'
254 if $conf->config('cust_main-custom_link')
255 || $conf->config('cust_main-custom_content');
257 my %viewname = reverse %views;
259 my $view = $cgi->param('show') || $curuser->default_customer_view;
260 $view = 'basics' if $view eq 'jumbo';
262 my $ie_compat = $conf->config('ie-compatibility_mode');
265 $head = qq(<meta http-equiv="X-UA-Compatible" content="IE=$ie_compat" />);