customer view UI
[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  (<% mt('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><% $conf->exists('unmask_ss')
33                               ? $cust_main->ss
34                               : $cust_main->masked('ss') || '&nbsp;' %></TD>
35 %   }
36   </TR>
37 %   if ( $conf->exists('cust_main-enable_spouse') and
38 %        ($cust_main->spouse_last or $cust_main->spouse_first) ) {
39   <TR>
40     <TH ALIGN="right"><% mt('Spouse') |h %></TH>
41     <TD COLSPAN=5>
42       <% join(', ', grep $_, 
43                     $cust_main->spouse_last, $cust_main->spouse_first) %>
44     </TD>
45   </TR>
46 % }
47 %   if ( $conf->exists('cust-email-high-visibility') ) {
48   <TR>
49     <TH ALIGN="right"><% mt('Email address(es)') |h %></TH>
50     <TD BGCOLOR="#ffff00">
51       <% $cust_main->invoicing_list_emailonly_scalar || $no %>
52     </TD>
53   </TR>
54 %   }
55 %   if ( $cust_main->company ) {
56   <TR>
57     <TH ALIGN="right"><% mt('Company') |h %></TH>
58     <TD COLSPAN=7><% $cust_main->company |h %></TD>
59   </TR>
60 %   }
61 % } elsif ( $this eq 'ship' ) {
62 %   if ( $cust_main->ship_company ) { # mostly obsolete these days...
63   <TR>
64     <TD ALIGN="right"><% mt('Company') |h %></TD>
65     <TD COLSPAN=7><% $cust_main->ship_company |h %></TD>
66   </TR>
67 %   }
68 % }
69
70
71 % if ( $location ) { # now the actual address
72
73 %   if ( $location->locationname ) {
74       <TR>
75         <TD ALIGN="right"><% mt('Location ID') |h %></TD>
76         <TD COLSPAN=7><% $location->locationname |h %></TD>
77       </TR>
78 %   }
79
80 <TR>
81   <TH ALIGN="right"><% mt('Address') |h %></TH>
82   <TD COLSPAN=7><% $location->address1 |h %></TD>
83 </TR>
84
85 % if ( $location->get('address2') ) {
86 %   my $address2_label = $conf->exists('cust_main-require_address2') 
87 %                        ? emt('Unit #')
88 %                        : ' ';
89
90 <TR>
91   <TH ALIGN="right"><% $address2_label %></TH>
92   <TD COLSPAN=7><% $location->address2 |h %></TD>
93 </TR>
94
95 % } 
96
97 <TR>
98   <TH></TH>
99   <TD COLSPAN=5><% $location->city |h %>\
100 % if ( $location->county ) {
101  (<% $location->county |h %> county)\
102 % }
103 ,<% state_label( $location->state, $location->country ) |h %>
104   <% $location->zip %>
105 </TD>
106 </TR>
107 <TR>
108   <TH></TH>
109   <TD><% code2country( $location->country ) %></TD>
110 </TR>
111
112 % if ( $location->latitude && $location->longitude ) {
113   <& /elements/tr-coords.html, $location->latitude,
114                                $location->longitude,
115                                $cust_main->name_short,
116                                $cust_main->agentnum,
117   &>
118 % }
119 <& /elements/tr-censustract.html, $location &>
120
121 % }
122   
123 % if ( $this eq 'bill' ) {
124 %   # billing contact phone numbers
125 %   foreach my $phone (qw(daytime night mobile)) {
126 %     next if !$cust_main->get($phone);
127 <TR>
128   <TD ALIGN="right"><% $phone_label{$phone} %></TD>
129   <TD COLSPAN=3>
130     <& /elements/phonenumber.html,
131         $cust_main->get($phone),
132         callable => 1,
133         calling_list_exempt => $cust_main->calling_list_exempt,
134     &>
135   </TD>
136 </TR>
137
138 %   } #foreach $phone
139 %   if ( $cust_main->get('fax') ) {
140
141   <TR>
142     <TD ALIGN="right"><% mt('Fax') |h %></TD>
143     <TD COLSPAN=3>
144       <% $cust_main->get('fax') || '&nbsp;' %>
145     </TD>
146   </TR>
147
148 %   }
149 %
150 %   if ( $conf->exists('show_stateid') ) { 
151
152 <TR>
153     <TD ALIGN="right"><% $stateid_label %></TD>
154     <TD><% $cust_main->masked('stateid') || '&nbsp' %></TD>
155     <TD ALIGN="right"><% $stateid_state_label %></TD>
156     <TD><% $cust_main->stateid_state || '&nbsp' %></TD>
157   </TR>
158
159 %   }
160 % } #if $this eq 'bill'
161 </TABLE>
162 % if ( @which ) {
163 <BR>
164 % }
165 % } #while @which
166 <%once>
167
168 my %phone_label = (
169
170   'daytime' => ( FS::Msgcat::_gettext('daytime') =~ /^(daytime)?$/
171                    ? 'Day&nbsp;Phone'
172                    : FS::Msgcat::_gettext('daytime')
173                ),
174
175   'night'   => ( FS::Msgcat::_gettext('night') =~ /^(night)?$/
176                    ? 'Night&nbsp;Phone'
177                    : FS::Msgcat::_gettext('night')
178                ),
179
180   'mobile'  => ( FS::Msgcat::_gettext('mobile') =~ /^(mobile)?$/
181                    ? 'Mobile&nbsp;Phone'
182                    : FS::Msgcat::_gettext('Mobile')
183                ),
184 );
185
186 my $stateid_label = FS::Msgcat::_gettext('stateid') =~ /^(stateid)?$/
187                       ? 'Driver&rsquo;s&nbsp;License'
188                       : FS::Msgcat::_gettext('stateid');
189 my $stateid_state_label = FS::Msgcat::_gettext('stateid_state') =~ /^(stateid_state)?$/
190                       ? 'Driver&rsquo;s&nbsp;License State'
191                       : FS::Msgcat::_gettext('stateid_state');
192
193 </%once>
194 <%init>
195
196 my $cust_main = shift;
197 my $conf = new FS::Conf;
198 my @invoicing_list = $cust_main->invoicing_list;
199 my $no = emt('no');
200
201 </%init>
202