RT#29406: Per customer option to display service address of package on invoice
[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     <TD ALIGN="right"><% mt('Contact name') |h %></TD>
29     <TD COLSPAN=5 BGCOLOR="#ffffff"><% $cust_main->contact |h %></TD>
30 %   if ( $conf->exists('show_ss') ) {
31     <TD ALIGN="right"><% mt('SS#') |h %></TD>
32     <TD BGCOLOR="#ffffff"><% $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     <TD ALIGN="right"><% mt('Spouse') |h %></TD>
41     <TD COLSPAN=5 BGCOLOR="#ffffff">
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     <TD ALIGN="right"><% mt('Email address(es)') |h %></TD>
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     <TD ALIGN="right"><% mt('Company') |h %></TD>
58     <TD COLSPAN=7 BGCOLOR="#ffffff"><% $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 BGCOLOR="#ffffff"><% $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 BGCOLOR="#ffffff"><% $location->locationname |h %></TD>
77       </TR>
78 %   }
79
80 <TR>
81   <TD ALIGN="right"><% mt('Address') |h %></TD>
82   <TD COLSPAN=7 BGCOLOR="#ffffff"><% $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   <TD ALIGN="right"><% $address2_label %></TD>
92   <TD COLSPAN=7 BGCOLOR="#ffffff"><% $location->address2 |h %></TD>
93 </TR>
94
95 % } 
96
97 <TR>
98   <TD ALIGN="right"><% mt('City') |h %></TD>
99   <TD BGCOLOR="#ffffff"><% $location->city |h %></TD>
100 % if ( $location->county ) {
101     <TD ALIGN="right"><% mt('County') |h %></TD>
102     <TD BGCOLOR="#ffffff"><% $location->county |h %></TD>
103 % }
104   <TD ALIGN="right"><% mt('State') |h %></TD>
105   <TD BGCOLOR="#ffffff"><% state_label( $location->state, $location->country ) |h %></TD>
106   <TD ALIGN="right"><% mt('Zip') |h %></TD>
107   <TD BGCOLOR="#ffffff"><% $location->zip %></TD>
108 </TR>
109 <TR>
110   <TD ALIGN="right"><% mt('Country') |h %></TD>
111   <TD BGCOLOR="#ffffff"><% code2country( $location->country ) %></TD>
112 </TR>
113
114 % if ( $location->latitude && $location->longitude ) {
115   <& /elements/tr-coords.html, $location->latitude,
116                                $location->longitude,
117                                $cust_main->name_short,
118                                $cust_main->agentnum,
119   &>
120 % }
121 <& /elements/tr-censustract.html, $location &>
122
123 % }
124   
125 % if ( $this eq 'bill' ) {
126 %   # billing contact phone numbers
127 %   foreach my $phone (qw(daytime night mobile)) {
128 %     next if !$cust_main->get($phone);
129 <TR>
130   <TD ALIGN="right"><% $phone_label{$phone} %></TD>
131   <TD COLSPAN=3 BGCOLOR="#ffffff">
132     <& /elements/phonenumber.html,
133         $cust_main->get($phone),
134         callable => 1,
135         calling_list_exempt => $cust_main->calling_list_exempt,
136     &>
137   </TD>
138 </TR>
139
140 %   } #foreach $phone
141 %   if ( $cust_main->get('fax') ) {
142
143   <TR>
144     <TD ALIGN="right"><% mt('Fax') |h %></TD>
145     <TD COLSPAN=3 BGCOLOR="#ffffff">
146       <% $cust_main->get('fax') || '&nbsp;' %>
147     </TD>
148   </TR>
149
150 %   }
151 %
152 %   if ( $conf->exists('show_stateid') ) { 
153
154 <TR>
155     <TD ALIGN="right"><% $stateid_label %></TD>
156     <TD BGCOLOR="#ffffff"><% $cust_main->masked('stateid') || '&nbsp' %></TD>
157     <TD ALIGN="right"><% $stateid_state_label %></TD>
158     <TD BGCOLOR="#ffffff"><% $cust_main->stateid_state || '&nbsp' %></TD>
159   </TR>
160
161 %   }
162 % } #if $this eq 'bill'
163 </TABLE>
164 % if ( @which ) {
165 <BR>
166 % }
167 % } #while @which
168 <%once>
169
170 my %phone_label = (
171
172   'daytime' => ( FS::Msgcat::_gettext('daytime') =~ /^(daytime)?$/
173                    ? 'Day&nbsp;Phone'
174                    : FS::Msgcat::_gettext('daytime')
175                ),
176
177   'night'   => ( FS::Msgcat::_gettext('night') =~ /^(night)?$/
178                    ? 'Night&nbsp;Phone'
179                    : FS::Msgcat::_gettext('night')
180                ),
181
182   'mobile'  => ( FS::Msgcat::_gettext('mobile') =~ /^(mobile)?$/
183                    ? 'Mobile&nbsp;Phone'
184                    : FS::Msgcat::_gettext('Mobile')
185                ),
186 );
187
188 my $stateid_label = FS::Msgcat::_gettext('stateid') =~ /^(stateid)?$/
189                       ? 'Driver&rsquo;s&nbsp;License'
190                       : FS::Msgcat::_gettext('stateid');
191 my $stateid_state_label = FS::Msgcat::_gettext('stateid_state') =~ /^(stateid_state)?$/
192                       ? 'Driver&rsquo;s&nbsp;License State'
193                       : FS::Msgcat::_gettext('stateid_state');
194
195 </%once>
196 <%init>
197
198 my $cust_main = shift;
199 my $conf = new FS::Conf;
200 my @invoicing_list = $cust_main->invoicing_list;
201 my $no = emt('no');
202
203 </%init>
204