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