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