0c5eb87b04ca2e364517e0e05c7ad65a25d9874c
[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              'nobr'  => 1,
16           }
17 &>
18
19 % my @part_tag = $cust_main->part_tag;
20 % if ( $conf->config('cust_tag-location') eq 'top' && @part_tag ) {
21 <TABLE STYLE="margin-bottom:8px" CELLSPACING=2>
22 %   foreach my $part_tag ( @part_tag ) {
23 <TR>
24   <TD>
25       <FONT SIZE="+1"
26             <% length($part_tag->tagcolor)
27                  ? 'STYLE="background-color:#'.$part_tag->tagcolor.'"'
28                  : ''
29       %>><% $part_tag->tagname.': '. $part_tag->tagdesc |h %></FONT>
30   </TD>
31 </TR>
32 %   }
33 </TABLE>
34 % }
35 <& /view/cust_main/menu.html, cust_main => $cust_main, show => $opt{'view'} &>
36 <BR>
37
38 <DIV CLASS="fstabcontainer">
39
40 <& /elements/init_overlib.html &>
41
42 <SCRIPT TYPE="text/javascript">
43 function areyousure(href, message) {
44   if (confirm(message) == true)
45     window.location.href = href;
46 }
47 function areyousure_popup(message, action, actionlabel) {
48   if (confirm(message) == true) {
49 <% include('/elements/popup_link_onclick.html',
50      'js_action' => 'action',
51      'js_actionlabel' => 'actionlabel',
52    ) %>
53   }
54 }
55 </SCRIPT>
56
57 <%init>
58
59 my $curuser = $FS::CurrentUser::CurrentUser;
60
61 my $conf = new FS::Conf;
62
63 my %opt = @_;
64
65 my $cust_main = $opt{'cust_main'} || qsearchs( {
66   'table'     => 'cust_main',
67   'hashref'   => { 'custnum' => $opt{'custnum'} },
68   'extra_sql' => ' AND '. $curuser->agentnums_sql,
69 });
70 die "Customer not found!" unless $cust_main;
71
72 my $title = mt("Customer").' #'. $cust_main->display_custnum. ': ';
73 my $title_noescape = $title. encode_entities($cust_main->name);
74 $title .= $cust_main->name;
75
76 if ( $curuser->num_agents ) {
77   $title_noescape =
78     encode_entities($cust_main->agent->agent). " $title_noescape";
79   $title = $cust_main->agent->agent. " $title";
80 }
81
82 my $status = $cust_main->status_label;
83 $status .= ' (Cancelled)' if $cust_main->is_status_delay_cancel;
84 $title_noescape .= ' (<B><FONT COLOR="#'. $cust_main->statuscolor. '">'. $status.  '</FONT></B>)';
85 $title .= " ($status)";
86
87 </%init>