RT# 32234 unmask_ss deprecated - drop from templates
[freeside.git] / httemplate / view / cust_main / contacts.html
1 % my %addr_label = ('bill' => 'Billing address', 'ship' => 'Service address');
2
3 %# Locations (possibly break this out)
4 % my @which = ('bill', 'ship');
5 % while (@which) {
6 %   my $this = shift @which;
7 %   my $method = $this.'_location';
8 %   my $location = $cust_main->$method;
9 <FONT CLASS="fsinnerbox-title"><% mt( $addr_label{$this} ) |h %>
10 %   if ( $this eq 'ship' and 
11 %       $cust_main->bill_locationnum == $cust_main->ship_locationnum )
12 %   {
13  (<% emt('same as billing') %>)
14 %   }
15 </FONT>
16 %   if (
17 %     ($this eq 'ship')
18 %     && $cust_main->invoice_ship_address 
19 %     && !$conf->exists('invoice-ship_address') #it's always on, so hide per-cust config
20 %    ) {
21 <SPAN STYLE="padding-left: .25em;">(<% emt('included on invoices') %>)</SPAN>
22 %   }
23 <TABLE CLASS="fsinnerbox">
24
25 % if ( $this eq 'bill' ) {
26 %   #billing contact fields
27   <TR>
28     <TH ALIGN="right"><% mt('Contact name') |h %></TH>
29     <TD COLSPAN=5><% $cust_main->contact |h %></TD>
30 %   if ( $conf->exists('show_ss') ) {
31     <TH ALIGN="right"><% mt('SS#') |h %></TH>
32     <TD>
33       <span id="ss_span" style="white-space:nowrap;">
34       <% $cust_main->masked('ss') || '&nbsp;' %>
35 %   if (
36 %         $cust_main->ss
37 %         && $FS::CurrentUser::CurrentUser->access_right('Unmask customer SSN')
38 %   ) {
39       <& /elements/link-replace_element_text.html, {
40            target_id    => 'ss_span',
41            replace_text => $cust_main->ss,
42            element_type => 'span'
43       } &>
44 %   }
45       </span>
46     </TD>
47 %   }
48   </TR>
49 %   if ( $conf->exists('cust_main-enable_spouse') and
50 %        ($cust_main->spouse_last or $cust_main->spouse_first) ) {
51   <TR>
52     <TH ALIGN="right"><% mt('Spouse') |h %></TH>
53     <TD COLSPAN=5>
54       <% join(', ', grep $_, 
55                     $cust_main->spouse_last, $cust_main->spouse_first) %>
56     </TD>
57   </TR>
58 %   }
59 %
60 %   # invoicing email
61 %   if ( scalar(@invoicing_list) == 1 ) { # typical individual user; show here
62   <TR>
63     <TH ALIGN="right"><% mt('Email address') |h %></TH>
64     <TD>
65       <% $invoicing_list[0] %>
66     </TD>
67   </TR>
68 %   } elsif ( scalar(@invoicing_list) > 1 ) {
69 %   # business customer with a contact list
70 %   # show nothing here
71 %
72 %   } else { # there is no invoice email for them
73   <TR>
74     <TH ALIGN="right"><% mt('Email address') |h %></TH>
75 %     if ( !$cust_main->postal_invoice or
76 %          $conf->exists('cust_main-require_invoicing_list_email',
77 %                        $cust_main->agentnum)
78 %     ) {
79 %       # we need a contact email for this customer (either because that's
80 %       # policy, or because otherwise they won't receive invoices) but we
81 %       # don't have one.
82     <TD CLASS="error"><% emt('none') %></TD>
83 %     } else {
84     <TD><% emt('no') %></TD>
85 %     }
86 %   } # end of invoicing email
87  
88 %   if ( $cust_main->company ) {
89   <TR>
90     <TH ALIGN="right"><% mt('Company') |h %></TH>
91     <TD COLSPAN=7><% $cust_main->company |h %></TD>
92   </TR>
93 %   }
94 % } elsif ( $this eq 'ship' ) {
95 %   if ( $cust_main->ship_company ) { # mostly obsolete these days...
96   <TR>
97     <TH ALIGN="right"><% mt('Company') |h %></TH>
98     <TD COLSPAN=7><% $cust_main->ship_company |h %></TD>
99   </TR>
100 %   }
101 % }
102
103
104 % if ( $location ) { # now the actual address
105
106 %   if ( $location->locationname ) {
107       <TR>
108         <TH ALIGN="right"><% mt('Location ID') |h %></TH>
109         <TD COLSPAN=7><% $location->locationname |h %></TD>
110       </TR>
111 %   }
112
113 <TR>
114   <TH ALIGN="right"><% mt('Address') |h %></TH>
115   <TD COLSPAN=7><% $location->address1 |h %></TD>
116 </TR>
117
118 % if ( $location->get('address2') ) {
119 %   my $address2_label = $conf->exists('cust_main-require_address2') 
120 %                        ? emt('Unit #')
121 %                        : ' ';
122
123 <TR>
124   <TH ALIGN="right"><% $address2_label %></TH>
125   <TD COLSPAN=7><% $location->address2 |h %></TD>
126 </TR>
127
128 % } 
129
130 <TR>
131   <TH></TH>
132   <TD COLSPAN=5><% $location->city |h %>\
133 % if ( $location->county ) {
134  (<% $location->county |h %> county)\
135 % }
136 <% ($location->city || $location->county) ? ', ' : ''%><% state_label( $location->state, $location->country ) |h %>
137   <% $location->zip |h %>
138 </TD>
139 </TR>
140 <TR>
141   <TH></TH>
142   <TD><% $location->country_full |h %></TD>
143 </TR>
144
145 % if ( $location->latitude && $location->longitude ) {
146   <& /elements/tr-coords.html, $location->latitude,
147                                $location->longitude,
148                                $cust_main->name_short,
149                                $cust_main->agentnum,
150   &>
151 % }
152 <& /elements/tr-censustract.html, $location &>
153
154 % }
155   
156 % if ( $this eq 'bill' ) {
157 %   # billing contact phone numbers
158 %   foreach my $phone (qw(daytime night mobile)) {
159 %     next if !$cust_main->get($phone);
160 <TR>
161   <TH ALIGN="right"><% $phone_label{$phone} %></TD>
162   <TD COLSPAN=3>
163     <& /elements/phonenumber.html,
164         $cust_main->get($phone),
165         callable => 1,
166         calling_list_exempt => $cust_main->calling_list_exempt,
167     &>
168   </TD>
169 </TR>
170
171 %   } #foreach $phone
172 %   if ( $cust_main->get('fax') ) {
173
174   <TR>
175     <TH ALIGN="right"><% mt('Fax') |h %></TH>
176     <TD COLSPAN=3>
177       <% $cust_main->get('fax') || '&nbsp;' %>
178     </TD>
179   </TR>
180
181 %   }
182 %
183 %   if ( $conf->exists('show_stateid') ) { 
184
185 <TR>
186     <TH ALIGN="right"><% $stateid_label %></TH>
187     <TD>
188       <span id="stateid_span" style="white-space:nowrap;">
189       <% $cust_main->masked('stateid') || '&nbsp' %>
190 %   if (
191 %         $cust_main->stateid
192 %         && $FS::CurrentUser::CurrentUser->access_right('Unmask customer DL')
193 %   ) {
194       <& /elements/link-replace_element_text.html, {
195            target_id => 'stateid_span',
196            replace_text => $cust_main->stateid,
197            element_type => 'span'
198       } &>
199 %   }
200       </span>
201     </TD>
202     <TH ALIGN="right"><% $stateid_state_label %></TH>
203     <TD><% $cust_main->stateid_state || '&nbsp' %></TD>
204   </TR>
205
206 %   }
207 % } #if $this eq 'bill'
208 </TABLE>
209 % if ( @which ) {
210 <BR>
211 % }
212 % } #while @which
213 <%once>
214
215 my %phone_label = (
216
217   'daytime' => ( FS::Msgcat::_gettext('daytime') =~ /^(daytime)?$/
218                    ? 'Day&nbsp;Phone'
219                    : FS::Msgcat::_gettext('daytime')
220                ),
221
222   'night'   => ( FS::Msgcat::_gettext('night') =~ /^(night)?$/
223                    ? 'Night&nbsp;Phone'
224                    : FS::Msgcat::_gettext('night')
225                ),
226
227   'mobile'  => ( FS::Msgcat::_gettext('mobile') =~ /^(mobile)?$/
228                    ? 'Mobile&nbsp;Phone'
229                    : FS::Msgcat::_gettext('Mobile')
230                ),
231 );
232
233 my $stateid_label = FS::Msgcat::_gettext('stateid') =~ /^(stateid)?$/
234                       ? 'Driver&rsquo;s&nbsp;License'
235                       : FS::Msgcat::_gettext('stateid');
236 my $stateid_state_label = FS::Msgcat::_gettext('stateid_state') =~ /^(stateid_state)?$/
237                       ? 'Driver&rsquo;s&nbsp;License State'
238                       : FS::Msgcat::_gettext('stateid_state');
239
240 </%once>
241 <%init>
242
243 my $cust_main = shift;
244 my $conf = new FS::Conf;
245 my @invoicing_list = $cust_main->invoicing_list_emailonly;
246
247 </%init>