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