dbc491af038e31f220c1743f26295c6e62fc0b76
[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 % # now the actual address
63 <TR>
64   <TD ALIGN="right"><% mt('Address') |h %></TD>
65   <TD COLSPAN=7 BGCOLOR="#ffffff"><% $location->address1 |h %></TD>
66 </TR>
67
68 % if ( $location->get('address2') ) {
69 %   my $address2_label = $conf->exists('cust_main-require_address2') 
70 %                        ? emt('Unit #')
71 %                        : ' ';
72
73 <TR>
74   <TD ALIGN="right"><% $address2_label %></TD>
75   <TD COLSPAN=7 BGCOLOR="#ffffff"><% $location->address2 |h %></TD>
76 </TR>
77
78 % } 
79
80 <TR>
81   <TD ALIGN="right"><% mt('City') |h %></TD>
82   <TD BGCOLOR="#ffffff"><% $location->city |h %></TD>
83 % if ( $location->county ) {
84     <TD ALIGN="right"><% mt('County') |h %></TD>
85     <TD BGCOLOR="#ffffff"><% $location->county |h %></TD>
86 % }
87   <TD ALIGN="right"><% mt('State') |h %></TD>
88   <TD BGCOLOR="#ffffff"><% state_label( $location->state, $location->country ) |h %></TD>
89   <TD ALIGN="right"><% mt('Zip') |h %></TD>
90   <TD BGCOLOR="#ffffff"><% $location->zip %></TD>
91 </TR>
92 <TR>
93   <TD ALIGN="right"><% mt('Country') |h %></TD>
94   <TD BGCOLOR="#ffffff"><% code2country( $location->country ) %></TD>
95 </TR>
96
97 % if ( $location->latitude && $location->longitude ) {
98   <& /elements/tr-coords.html, $location->latitude,
99                                $location->longitude,
100                                $cust_main->name_short,
101                                $cust_main->agentnum,
102   &>
103 % }
104 <& /elements/tr-censustract.html, $location &>
105   
106 % if ( $this eq 'bill' ) {
107 %   # billing contact phone numbers
108 %   foreach my $phone (qw(daytime night mobile)) {
109 %     next if !$cust_main->get($phone);
110 <TR>
111   <TD ALIGN="right"><% $phone_label{$phone} %></TD>
112   <TD COLSPAN=3 BGCOLOR="#ffffff">
113     <& /elements/phonenumber.html,
114         $cust_main->get($phone),
115         callable => 1,
116         calling_list_exempt => $cust_main->calling_list_exempt,
117     &>
118   </TD>
119 </TR>
120
121 %   } #foreach $phone
122 %   if ( $cust_main->get('fax') ) {
123
124   <TR>
125     <TD ALIGN="right"><% mt('Fax') |h %></TD>
126     <TD COLSPAN=3 BGCOLOR="#ffffff">
127       <% $cust_main->get('fax') || '&nbsp;' %>
128     </TD>
129   </TR>
130
131 %   }
132 %
133 %   if ( $conf->exists('show_stateid') ) { 
134
135 <TR>
136     <TD ALIGN="right"><% $stateid_label %></TD>
137     <TD BGCOLOR="#ffffff"><% $cust_main->masked('stateid') || '&nbsp' %></TD>
138     <TD ALIGN="right"><% $stateid_state_label %></TD>
139     <TD BGCOLOR="#ffffff"><% $cust_main->stateid_state || '&nbsp' %></TD>
140   </TR>
141
142 %   }
143 % } #if $this eq 'bill'
144 </TABLE>
145 % if ( @which ) {
146 <BR>
147 % }
148 % } #while @which
149 <%once>
150
151 my %phone_label = (
152
153   'daytime' => ( FS::Msgcat::_gettext('daytime') =~ /^(daytime)?$/
154                    ? 'Day&nbsp;Phone'
155                    : FS::Msgcat::_gettext('daytime')
156                ),
157
158   'night'   => ( FS::Msgcat::_gettext('night') =~ /^(night)?$/
159                    ? 'Night&nbsp;Phone'
160                    : FS::Msgcat::_gettext('night')
161                ),
162
163   'mobile'  => ( FS::Msgcat::_gettext('mobile') =~ /^(mobile)?$/
164                    ? 'Mobile&nbsp;Phone'
165                    : FS::Msgcat::_gettext('Mobile')
166                ),
167 );
168
169 my $stateid_label = FS::Msgcat::_gettext('stateid') =~ /^(stateid)?$/
170                       ? 'Driver&rsquo;s&nbsp;License'
171                       : FS::Msgcat::_gettext('stateid');
172 my $stateid_state_label = FS::Msgcat::_gettext('stateid_state') =~ /^(stateid_state)?$/
173                       ? 'Driver&rsquo;s&nbsp;License State'
174                       : FS::Msgcat::_gettext('stateid_state');
175
176 </%once>
177 <%init>
178
179 my $cust_main = shift;
180 my $conf = new FS::Conf;
181 my @invoicing_list = $cust_main->invoicing_list;
182 my $no = emt('no');
183
184 </%init>
185