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