15def3283c5b7086d543c2e3e9193e1c1afff9af
[freeside.git] / httemplate / view / cust_main / misc.html
1 <TABLE CLASS="fsinnerbox">
2
3 <TR>
4   <TD ALIGN="right"><% mt('Customer number') |h %></TD>
5   <TD BGCOLOR="#ffffff"><% $cust_main->display_custnum %></TD>
6 </TR>
7
8 <TR>
9   <TD ALIGN="right"><% mt('Status') |h %></TD>
10   <TD BGCOLOR="#ffffff"><FONT COLOR="#<% $cust_main->statuscolor %>"><B><% $cust_main->status_label %></B></FONT></TD>
11 </TR>
12
13 % my @part_tag = $cust_main->part_tag;
14 % if ( $conf->config('cust_tag-location') =~ /^(cust_misc|)$/ && @part_tag ) {
15 <TR>
16   <TD ALIGN="right"><% mt('Tags') |h %></TD>
17   <TD BGCOLOR="#ffffff">
18 %   foreach my $part_tag ( @part_tag ) {
19       <FONT <% length($part_tag->tagcolor)
20                  ? 'STYLE="background-color:#'.$part_tag->tagcolor.'"'
21                  : '' %>
22       ><% $part_tag->tagname.': '. $part_tag->tagdesc |h %></FONT>
23       <BR>
24 %   }
25   </TD>
26 </TR>
27 % }
28
29 %unless ( scalar(@agentnums) == 1
30 %         && !$curuser->access_right('View customers of all agents')  ) {
31 %  my $agent = qsearchs('agent',{ 'agentnum' => $cust_main->agentnum } );
32    <TR>
33      <TD ALIGN="right"><% mt('Agent') |h %></TD>
34      <TD BGCOLOR="#ffffff"><% $agent->agentnum %>: <% $agent->agent %></TD>
35    </TR>
36 % }
37
38 %  if ( $cust_main->agent_custid
39 %       && ! $conf->exists('cust_main-default_agent_custid') ) {
40
41 <TR>
42   <TD ALIGN="right"><% mt('Agent customer ref#') |h %></TD>
43   <TD BGCOLOR="#ffffff"><% $cust_main->agent_custid %></TD>
44 </TR>
45 %
46 %  }
47
48 %  #if ( $cust_main->classnum ) {
49      <TR>
50        <TD ALIGN="right"><% mt('Class') |h %></TD>
51        <TD BGCOLOR="#ffffff"><% $cust_main->classname || '('.emt('none').')' %></TD>
52      </TR>
53 %  #}
54
55 % if ( $cust_main->salesnum ) {
56     <TR>
57       <TD ALIGN="right"><% mt('Sales Person') |h %></TD>
58       <TD BGCOLOR="#ffffff"><% $cust_main->salesperson |h %></TD>
59     </TR>
60 % }
61
62 %  unless ( FS::part_referral->num_part_referral == 1 ) {
63 %    my $referral = qsearchs('part_referral', {
64 %      'refnum' => $cust_main->refnum
65 %    } );
66
67 <TR>
68   <TD ALIGN="right"><% mt('Advertising source') |h %></TD>
69   <TD BGCOLOR="#ffffff"><% $referral->refnum %>: <% $referral->referral%></TD>
70 </TR>
71 % } 
72
73
74 <TR>
75   <TD ALIGN="right"><% mt('Referring Customer') |h %></TD>
76   <TD BGCOLOR="#ffffff">
77 %
78 %  my $referring_cust_main = '';
79 %  if ( $cust_main->referral_custnum
80 %       && ( $referring_cust_main =
81 %            qsearchs('cust_main', { custnum => $cust_main->referral_custnum } )
82 %          )
83 %     ) {
84 %
85
86
87 <A HREF="<% popurl(1) %>cust_main.cgi?<% $cust_main->referral_custnum %>"><%$referring_cust_main->display_custnum %>: 
88 <%
89   ( $referring_cust_main->company
90       ? $referring_cust_main->company. ' ('.
91           $referring_cust_main->last. ', '. $referring_cust_main->first.
92           ')'
93       : $referring_cust_main->last. ', '. $referring_cust_main->first
94   )
95 %></A>
96 % } 
97
98
99   </TD>
100 </TR>
101
102 <TR>
103   <TD ALIGN="right"><% mt('Order taker') |h %></TD>
104   <TD BGCOLOR="#ffffff"><% $cust_main->otaker %></TD>
105 </TR>
106
107   <TR>
108     <TD ALIGN="right"><% mt('Signup Date') |h %></TD>
109     <TD BGCOLOR="#ffffff"><% $cust_main->signupdate ? time2str($date_format, $cust_main->signupdate) : '' %></TD>
110   </TR>
111
112 % my $id_country = $conf->config('national_id-country');
113 %  if ( $id_country ) {
114 %   if ( $id_country eq 'MY' ) {
115       <TR>
116 %     my($old, $nric) = ( '', '');
117 %     if ( $cust_main->national_id =~ /^\d{6}\-\d{2}\-\d{4}$/ ) {
118           <TD ALIGN="right"><% mt('NRIC') |h %></TD>
119 %     } else { # elsif ( $cust_main->national_id =~ /^\w\d{9}$/ ) {
120           <TD ALIGN="right"><% mt('Old IC/Passport') |h %></TD>
121 %     #} else {
122 %     #  warn "unknown national_id format";
123 %#         <TD ALIGN="right"></TD>
124 %     }
125         <TD BGCOLOR="#ffffff"><% $cust_main->national_id |h %></TD>
126       </TR>
127 %   } else {
128 %     warn "unknown national_id-country $id_country";
129 %   }
130 % }
131
132 % if ( $conf->exists('cust_main-enable_birthdate') ) {
133 %   my $dt = $cust_main->birthdate ne ''
134 %              ? DateTime->from_epoch( 'epoch'     => $cust_main->birthdate,
135 %                                      'time_zone' =>'floating',
136 %                                    )
137 %              : '';
138
139   <TR>
140     <TD ALIGN="right"><% mt('Date of Birth') |h %></TD>
141     <TD BGCOLOR="#ffffff"><% $dt ? $dt->strftime($date_format) : '' %></TD>
142   </TR>
143
144 %   if ( $conf->exists('cust_main-enable_spouse') 
145 %        and $cust_main->spouse_birthdate ) {
146 %     my $dt = DateTime->from_epoch(
147 %                   'epoch'  => $cust_main->spouse_birthdate,
148 %                   'time_zone' =>'floating'
149 %              );
150
151   <TR>
152     <TD ALIGN="right"><% mt('Spouse Date of Birth') |h %></TD>
153     <TD BGCOLOR="#ffffff"><% $dt ? $dt->strftime($date_format) : '' %></TD>
154   </TR>
155
156 %   }
157 % } # enable_birthdate
158
159 % if ( $conf->exists('cust_main-enable_anniversary_date') ) {
160 %   my $dt = $cust_main->anniversary_date ne ''
161 %              ? DateTime->from_epoch( 'epoch'  => $cust_main->anniversary_date,
162 %                                      'time_zone' =>'floating',
163 %                                    )
164 %              : '';
165
166   <TR>
167     <TD ALIGN="right"><% mt('Anniversary Date') |h %></TD>
168     <TD BGCOLOR="#ffffff"><% $dt ? $dt->strftime($date_format) : '' %></TD>
169   </TR>
170
171 % }
172
173 % if ( $cust_main->district ) {
174
175   <TR>
176     <TD ALIGN="right"><% mt('Tax district') |h %></TD>
177     <TD BGCOLOR="#ffffff"><% $cust_main->ship_location->district %></TD>
178   </TR>
179
180 % }
181
182
183 % if ( $conf->exists('ticket_system-selfservice_edit_subject') ) {
184
185   <TR>
186     <TD ALIGN="right"><% mt('Edit ticket subjects') %></TD>
187     <TD BGCOLOR="#ffffff"><% $cust_main->edit_subject ? 'yes' : 'no' %></TD>
188   </TR>
189
190 % }
191
192 % foreach (sort { $a cmp $b } $cust_main->virtual_fields) {
193     <% $cust_main->pvf($_)->widget('HTML', 'view', $cust_main->getfield($_)) %>
194 % }
195
196 </TABLE>
197 <%init>
198
199 my( $cust_main ) = @_;
200 my $conf = new FS::Conf;
201 my $date_format = ($conf->config('date_format') || "%m/%d/%Y");
202
203 my $curuser = $FS::CurrentUser::CurrentUser;
204
205 my @agentnums = $curuser->agentnums;
206
207 </%init>