b743f5acf2e4e9427633b17120d4809d84a7d77d
[freeside.git] / httemplate / elements / header-cust_main.html
1 <%doc>
2
3 Examples:
4
5   <& /elements/header-cust_main.html,
6        view      => 'basics', #required
7        cust_main => $cust_main, # cust_main or custnum is required
8        custnum   => $custnum,   #
9   &>
10
11 </%doc>
12 <& /elements/header.html, {
13              'title'             => $title,
14              'title_noescape'    => $title_noescape,
15              'head'              => $head,
16              'etc'               => $opt{'etc'},
17              'include_selectize' => $opt{include_selectize} ? 1 : 0,
18              #'nobr'             => 1,
19           }
20 &>
21
22 % my @part_tag = $cust_main->part_tag;
23 % if ( $conf->config('cust_tag-location') eq 'top' && @part_tag ) {
24 <TABLE STYLE="margin-bottom:8px" CELLSPACING=2>
25 %   foreach my $part_tag ( @part_tag ) {
26 <TR>
27   <TD>
28       <FONT SIZE="+1"
29             <% length($part_tag->tagcolor)
30                  ? 'STYLE="background-color:#'.$part_tag->tagcolor.'"'
31                  : ''
32       %>><% $part_tag->tagname.': '. $part_tag->tagdesc |h %></FONT>
33   </TD>
34 </TR>
35 %   }
36 </TABLE>
37 % }
38 <& /view/cust_main/menu.html, cust_main => $cust_main, show => $opt{'view'} &>
39 <BR>
40
41 <DIV CLASS="fstabcontainer">
42
43 <& /elements/init_overlib.html &>
44
45 <SCRIPT TYPE="text/javascript">
46 function areyousure(href, message) {
47   if (confirm(message) == true)
48     window.location.href = href;
49 }
50 function areyousure_popup(message, action, actionlabel) {
51   if (confirm(message) == true) {
52 <% include('/elements/popup_link_onclick.html',
53      'js_action' => 'action',
54      'js_actionlabel' => 'actionlabel',
55    ) %>
56   }
57 }
58 </SCRIPT>
59
60 <%init>
61
62 my $curuser = $FS::CurrentUser::CurrentUser;
63
64 my $conf = new FS::Conf;
65
66 my %opt = @_;
67
68 my $cust_main = $opt{'cust_main'} || qsearchs( {
69   'table'     => 'cust_main',
70   'hashref'   => { 'custnum' => $opt{'custnum'} },
71   'extra_sql' => ' AND '. $curuser->agentnums_sql,
72 });
73 die "Customer not found!" unless $cust_main;
74
75 my $title = mt("Customer").' #'. $cust_main->display_custnum. ': ';
76 my $title_noescape = $title. encode_entities($cust_main->name);
77 $title .= $cust_main->name;
78
79 if ( $curuser->num_agents ) {
80   $title_noescape =
81     encode_entities($cust_main->agent->agent). " $title_noescape";
82   $title = $cust_main->agent->agent. " $title";
83 }
84
85 my $status = $cust_main->status_label;
86 $status .= ' (Cancelled)' if $cust_main->is_status_delay_cancel;
87 $title_noescape .= ' (<B><FONT COLOR="#'. $cust_main->statuscolor. '">'. $status.  '</FONT></B>)';
88 $title .= " ($status)";
89
90 my $ie_compat = $conf->config('ie-compatibility_mode');
91 my $head = '';
92 if ( $ie_compat ) {
93   $head = qq(<meta http-equiv="X-UA-Compatible" content="IE=$ie_compat" />);
94 }
95
96 </%init>