default to a session cookie instead of setting an explicit timeout, weird timezone...
[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     'etc'             => $opt{'etc'},
17     include_selectize => $opt{include_selectize} ? 1 : 0,
18 } &>
19
20 % my @part_tag = $cust_main->part_tag;
21 % if ( $conf->config('cust_tag-location') eq 'top' && @part_tag ) {
22 <TABLE STYLE="margin-bottom:8px" CELLSPACING=2>
23 %   foreach my $part_tag ( @part_tag ) {
24 <TR>
25   <TD>
26       <FONT SIZE="+1"
27             <% length($part_tag->tagcolor)
28                  ? 'STYLE="background-color:#'.$part_tag->tagcolor.'"'
29                  : ''
30       %>><% $part_tag->tagname.': '. $part_tag->tagdesc |h %></FONT>
31   </TD>
32 </TR>
33 %   }
34 </TABLE>
35 % }
36 % if ( scalar @cust_locations_missing_district ) {
37   <div style="margin: 0 1em; padding: 1em; border: solid 1px #999; background-color: #fee;">
38     <h4 style="margin: 0; border-bottom: solid 1px #aaa; color: red;">Customer will not be billed:</h4>
39     <p style="margin: .5em;">
40     The following customer locations are missing tax districts for Washington State.<br>
41     Sales taxes cannot be calculated for this customer.<br>
42     Correct the address information, or enter a tax district number.
43     <ul>
44 %   for my $cust_location ( @cust_locations_missing_district ) {
45       <li>
46         (<a href="#" onclick="overlib_edit_location(<% $cust_location->locationnum %>);">
47           EDIT
48         </a>)
49         <% $cust_location->address1 %>
50         <% $cust_location->city %>
51         <% $cust_location->state %>
52         <% $cust_location->zip %>
53         (<% $cust_location->locationnum %>)
54       </li>
55 %   } # /for my $cust_location
56     </ul>
57   </div>
58   <script>
59     function overlib_edit_location(locationnum) {
60       overlib(
61         OLiframeContent(
62           '<% $fsurl %>edit/cust_location.cgi?locationnum=' + locationnum,
63           700, 355,
64           'popup-1548013977-3901-3256727185.50958',
65           0,
66           'auto'
67         ),
68         CAPTION, 'Edit location',
69         STICKY,
70         AUTOSTATUSCAP,
71         MIDX, 0,
72         MIDY, 0,
73         DRAGGABLE,
74         CLOSECLICK,
75         TEXTPADDING, 0,
76         BASE, 0,
77         BGCOLOR, '#333399',
78         CGCOLOR, '#333399',
79         FGCOLOR, '#f8f8f8',
80         CLOSETEXT, 'Close'
81       );
82       return false;
83     }
84   </script>
85   <br>
86 % } # /if @cust_locations_missing_district
87 <& /view/cust_main/menu.html, cust_main => $cust_main, show => $opt{'view'} &>
88 <BR>
89
90 <DIV CLASS="fstabcontainer">
91
92 <& /elements/init_overlib.html &>
93
94 <SCRIPT TYPE="text/javascript">
95 function areyousure(href, message) {
96   if (confirm(message) == true)
97     window.location.href = href;
98 }
99 function areyousure_popup(message, action, actionlabel) {
100   if (confirm(message) == true) {
101 <% include('/elements/popup_link_onclick.html',
102      'js_action' => 'action',
103      'js_actionlabel' => 'actionlabel',
104    ) %>
105   }
106 }
107 </SCRIPT>
108
109 <%init>
110
111 my $curuser = $FS::CurrentUser::CurrentUser;
112
113 my $conf = new FS::Conf;
114
115 my %opt = @_;
116
117 my $cust_main = $opt{'cust_main'} || qsearchs( {
118   'table'     => 'cust_main',
119   'hashref'   => { 'custnum' => $opt{'custnum'} },
120   'extra_sql' => ' AND '. $curuser->agentnums_sql,
121 });
122 die "Customer not found!" unless $cust_main;
123
124 my $title = mt("Customer").' #'. $cust_main->display_custnum. ': ';
125 my $title_noescape = $title. encode_entities($cust_main->name);
126 $title .= $cust_main->name;
127
128 if ( $curuser->num_agents ) {
129   $title_noescape =
130     encode_entities($cust_main->agent->agent). " $title_noescape";
131   $title = $cust_main->agent->agent. " $title";
132 }
133
134 my $status = $cust_main->status_label;
135 $status .= ' (Cancelled)' if $cust_main->is_status_delay_cancel;
136 $title_noescape .= ' (<B><FONT COLOR="#'. $cust_main->statuscolor. '">'. $status.  '</FONT></B>)';
137 $title .= " ($status)";
138
139 my @cust_locations_missing_district;
140 my $tax_district_method = $conf->config('tax_district_method');
141 if ( $tax_district_method && $tax_district_method eq 'wa_sales' ) {
142   @cust_locations_missing_district = $cust_main->cust_locations_missing_district();
143 }
144
145 </%init>