1 <& /elements/header.html, {
3 'title_noescape' => $title_noescape,
10 % my @part_tag = $cust_main->part_tag;
11 % if ( $conf->config('cust_tag-location') eq 'top' && @part_tag ) {
12 <TABLE STYLE="margin-bottom:8px" CELLSPACING=2>
13 % foreach my $part_tag ( @part_tag ) {
17 <% length($part_tag->tagcolor)
18 ? 'STYLE="background-color:#'.$part_tag->tagcolor.'"'
20 %>><% $part_tag->tagname.': '. $part_tag->tagdesc |h %></FONT>
27 <& cust_main/menu.html, cust_main => $cust_main, show => $view &>
30 <DIV CLASS="fstabcontainer">
32 <& /elements/init_overlib.html &>
34 <SCRIPT TYPE="text/javascript">
35 function areyousure(href, message) {
36 if (confirm(message) == true)
37 window.location.href = href;
47 % if ( $view eq 'basics' ) {
50 % if ( $curuser->access_right('Order customer package') && $conf->exists('cust_main-enable_order_package') ) {
51 | <& /elements/order_pkg_link.html, 'cust_main'=>$cust_main &>
54 % if ( $conf->config('cust_main-external_links') ) {
55 <% $br++ ? ' | ' : '' %>
56 % my @links = split(/\n/, $conf->config('cust_main-external_links'));
57 % foreach my $link (@links) {
58 % $link =~ /^\s*(\S+)\s+(.*?)(\s*\(([^\)]*)\))?$/ or next;
59 % my($url, $label, $alt) = ($1, $2, $4);
60 <A HREF="<% $url.$custnum %>" ALT="<% $alt |h %>"><% $label |h %></A>
68 %my $signupurl = $conf->config('signupurl');
70 <% mt('This customer\'s signup URL:') |h %>
71 <A HREF="<% $signupurl %>?ref=<% $custnum %>"><% $signupurl %>?ref=<% $custnum %></A>
78 <& cust_main/contacts.html, $cust_main &>
80 <& cust_main/misc.html, $cust_main &>
82 <TD VALIGN="top" STYLE="padding-left: 54px">
83 <& cust_main/billing.html, $cust_main &>
85 <& cust_main/cust_payby.html, $cust_main &>
90 <& cust_main/contacts_new.html, $cust_main &>
102 % if ( $view eq 'notes' ) {
103 <& cust_main/notes.html, 'cust_main' => $cust_main &>
112 % if ( $view eq 'tickets' ) {
114 % if ( $conf->config('ticket_system') ) {
115 <& cust_main/tickets.html, $cust_main &>
125 % if ( $view eq 'appointments' ) {
127 % if ( $conf->config('ticket_system')
128 % && $curuser->access_right('View appointments') ) {
129 <& cust_main/appointments.html, $cust_main &>
140 % if ( $view eq 'quotations' ) {
142 % if ( $curuser->access_right('Generate quotation') ) {
143 <& cust_main/quotations.html, $cust_main &>
153 % if ( $view eq 'packages' ) {
155 % #XXX enable me# if ( $curuser->access_right('View customer packages') {
156 <& cust_main/packages.html, $cust_main &>
167 % if ( $view eq 'payment_history' ) {
169 <& cust_main/payment_history.html, $cust_main &>
179 % if ( $view eq 'change_history' ) {
180 <& cust_main/change_history.html, $cust_main &>
184 % if ( $view eq 'custom' ) {
185 % if ( $conf->config('cust_main-custom_link') ) {
186 <& cust_main/custom.html, $cust_main &>
187 % } elsif ( $conf->config('cust_main-custom_content') ) {
188 <& cust_main/custom_content.html, $cust_main &>
190 % # warn "custom view without cust_main-custom_link or -custom_content?";
195 <& /elements/footer.html &>
198 my $curuser = $FS::CurrentUser::CurrentUser;
201 unless $curuser->access_right('View customer');
203 my $conf = new FS::Conf;
206 if ( $cgi->param('custnum') =~ /^(\d+)$/ ) {
209 die "No customer specified (bad URL)!" unless $cgi->keywords;
210 my($query) = $cgi->keywords; # needs parens with my, ->keywords returns array
213 $cgi->delete('keywords');
214 $cgi->param('custnum', $1);
217 my $cust_main = qsearchs( {
218 'table' => 'cust_main',
219 'hashref' => { 'custnum' => $custnum },
220 'extra_sql' => ' AND '. $curuser->agentnums_sql,
222 die "Customer not found!" unless $cust_main;
224 my $title = encode_entities($cust_main->name);
225 $title = '#'. $cust_main->display_custnum. " $title";
226 # if $conf->exists('cust_main-title-display_custnum');
227 $title = mt("Customer")." ".$title;
229 my @agentnums = $curuser->agentnums;
230 if (scalar(@agentnums) > 1 ) {
231 $title = encode_entities($cust_main->agent->agent). " $title";
234 my $status = $cust_main->status_label;
235 $status .= ' (Cancelled)' if $cust_main->is_status_delay_cancel;
236 my $title_noescape = $title. ' (<B><FONT COLOR="#'. $cust_main->statuscolor. '">'. $status. '</FONT></B>)';
237 $title .= " ($status)";
239 #false laziness w/pref/pref.html and Conf.pm (cust_main-default_view)
240 tie my %views, 'Tie::IxHash',
241 emt('Basics') => 'basics',
242 emt('Notes') => 'notes', #notes and files?
244 if ( $conf->config('ticket_system') ) {
245 $views{emt('Tickets')} = 'tickets';
246 $views{emt('Appointments')} = 'appointments'
247 if $curuser->access_right('View appointments');
249 $views{emt('Quotations')} = 'quotations';
250 $views{emt('Packages')} = 'packages';
251 $views{emt('Payment History')} = 'payment_history';
252 $views{emt('Change History')} = 'change_history'
253 if $curuser->access_right('View customer history');
254 $views{$conf->config('cust_main-custom_title') || emt('Custom')} = 'custom'
255 if $conf->config('cust_main-custom_link')
256 || $conf->config('cust_main-custom_content');
258 my %viewname = reverse %views;
260 my $view = $cgi->param('show') || $curuser->default_customer_view;
261 $view = 'basics' if $view eq 'jumbo';
263 my $ie_compat = $conf->config('ie-compatibility_mode');
266 $head = qq(<meta http-equiv="X-UA-Compatible" content="IE=$ie_compat" />);