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