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;
38 function areyousure_popup(message, action, actionlabel) {
39 if (confirm(message) == true) {
40 <% include('/elements/popup_link_onclick.html',
41 'js_action' => 'action',
42 'js_actionlabel' => 'actionlabel',
54 % if ( $view eq 'basics' ) {
58 % if ( $conf->config('cust_main-external_links') ) {
59 <% $br++ ? ' | ' : '' %>
60 % my @links = split(/\n/, $conf->config('cust_main-external_links'));
61 % foreach my $link (@links) {
62 % $link =~ /^\s*(\S+)\s+(.*?)(\s*\(([^\)]*)\))?$/ or next;
63 % my($url, $label, $alt) = ($1, $2, $4);
64 <A HREF="<% $url.$custnum %>" ALT="<% $alt |h %>"><% $label |h %></A>
72 %my $signupurl = $conf->config('signupurl');
74 <% mt('This customer\'s signup URL:') |h %>
75 <A HREF="<% $signupurl %>?ref=<% $custnum %>"><% $signupurl %>?ref=<% $custnum %></A>
82 <& cust_main/contacts.html, $cust_main &>
84 <& cust_main/misc.html, $cust_main &>
86 <TD VALIGN="top" STYLE="padding-left: 54px">
87 <& cust_main/billing.html, $cust_main &>
89 <& cust_main/cust_payby.html, $cust_main &>
94 <& cust_main/contacts_new.html, $cust_main &>
106 % if ( $view eq 'notes' ) {
107 <& cust_main/notes.html, 'cust_main' => $cust_main &>
116 % if ( $view eq 'tickets' ) {
118 % if ( $conf->config('ticket_system') ) {
119 <& cust_main/tickets.html, $cust_main &>
129 % if ( $view eq 'appointments' ) {
131 % if ( $conf->config('ticket_system')
132 % && $curuser->access_right('View appointments') ) {
133 <& cust_main/appointments.html, $cust_main &>
144 % if ( $view eq 'quotations' ) {
146 % if ( $curuser->access_right('Generate quotation') ) {
147 <& cust_main/quotations.html, $cust_main &>
157 % if ( $view eq 'packages' ) {
159 % #XXX enable me# if ( $curuser->access_right('View customer packages') {
160 <& cust_main/packages.html, $cust_main &>
171 % if ( $view eq 'payment_history' ) {
173 <& cust_main/payment_history.html, $cust_main &>
183 % if ( $view eq 'change_history' ) {
184 <& cust_main/change_history.html, $cust_main &>
188 % if ( $view eq 'custom' ) {
189 % if ( $conf->config('cust_main-custom_link') ) {
190 <& cust_main/custom.html, $cust_main &>
191 % } elsif ( $conf->config('cust_main-custom_content') ) {
192 <& cust_main/custom_content.html, $cust_main &>
194 % # warn "custom view without cust_main-custom_link or -custom_content?";
199 <& /elements/footer.html &>
202 my $curuser = $FS::CurrentUser::CurrentUser;
205 unless $curuser->access_right('View customer');
207 my $conf = new FS::Conf;
210 if ( $cgi->param('custnum') =~ /^(\d+)$/ ) {
213 die "No customer specified (bad URL)!" unless $cgi->keywords;
214 my($query) = $cgi->keywords; # needs parens with my, ->keywords returns array
217 $cgi->delete('keywords');
218 $cgi->param('custnum', $1);
221 my $cust_main = qsearchs( {
222 'table' => 'cust_main',
223 'hashref' => { 'custnum' => $custnum },
224 'extra_sql' => ' AND '. $curuser->agentnums_sql,
226 die "Customer not found!" unless $cust_main;
228 my $title = mt("Customer").' #'. $cust_main->display_custnum. ': ';
229 my $title_noescape = $title. encode_entities($cust_main->name);
230 $title .= $cust_main->name;
232 if ( $curuser->num_agents ) {
234 encode_entities($cust_main->agent->agent). " $title_noescape";
235 $title = $cust_main->agent->agent. " $title";
238 my $status = $cust_main->status_label;
239 $status .= ' (Cancelled)' if $cust_main->is_status_delay_cancel;
240 $title_noescape .= ' (<B><FONT COLOR="#'. $cust_main->statuscolor. '">'. $status. '</FONT></B>)';
241 $title .= " ($status)";
243 #false laziness w/pref/pref.html and Conf.pm (cust_main-default_view)
244 tie my %views, 'Tie::IxHash',
245 emt('Basics') => 'basics',
246 emt('Notes') => 'notes', #notes and files?
248 if ( $conf->config('ticket_system') ) {
249 $views{emt('Tickets')} = 'tickets';
250 $views{emt('Appointments')} = 'appointments'
251 if $curuser->access_right('View appointments');
253 $views{emt('Quotations')} = 'quotations';
254 $views{emt('Packages')} = 'packages';
255 $views{emt('Payment History')} = 'payment_history';
256 $views{emt('Change History')} = 'change_history'
257 if $curuser->access_right('View customer history');
258 $views{$conf->config('cust_main-custom_title') || emt('Custom')} = 'custom'
259 if $conf->config('cust_main-custom_link')
260 || $conf->config('cust_main-custom_content');
262 my %viewname = reverse %views;
264 my $view = $cgi->param('show') || $curuser->default_customer_view;
265 $view = 'basics' if $view eq 'jumbo';
267 my $ie_compat = $conf->config('ie-compatibility_mode');
270 $head = qq(<meta http-equiv="X-UA-Compatible" content="IE=$ie_compat" />);