summaryrefslogtreecommitdiff
path: root/httemplate/view/cust_main/contacts.html
blob: a41a4836b7f128d5cfc13d83745c7c27ada1bb96 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
% my %addr_label = ('bill' => 'Billing address', 'ship' => 'Service address');

%# Locations (possibly break this out)
% my @which = ('bill', 'ship');
% while (@which) {
%   my $this = shift @which;
%   my $method = $this.'_location';
%   my $location = $cust_main->$method;
<FONT CLASS="fsinnerbox-title"><% mt( $addr_label{$this} ) |h %>
%   if ( $this eq 'ship' and 
%       $cust_main->bill_locationnum == $cust_main->ship_locationnum )
%   {
 (<% mt('same as billing') %>)
%   }
</FONT>
%   if (
%     ($this eq 'ship')
%     && $cust_main->invoice_ship_address 
%     && !$conf->exists('invoice-ship_address') #it's always on, so hide per-cust config
%    ) {
<SPAN STYLE="padding-left: .25em;">(<% emt('included on invoices') %>)</SPAN>
%   }
<TABLE CLASS="fsinnerbox">

% if ( $this eq 'bill' ) {
%   #billing contact fields
  <TR>
    <TH ALIGN="right"><% mt('Contact name') |h %></TH>
    <TD COLSPAN=5><% $cust_main->contact |h %></TD>
%   if ( $conf->exists('show_ss') ) {
    <TH ALIGN="right"><% mt('SS#') |h %></TH>
    <TD><% $conf->exists('unmask_ss')
                              ? $cust_main->ss
                              : $cust_main->masked('ss') || '&nbsp;' %></TD>
%   }
  </TR>
%   if ( $conf->exists('cust_main-enable_spouse') and
%        ($cust_main->spouse_last or $cust_main->spouse_first) ) {
  <TR>
    <TH ALIGN="right"><% mt('Spouse') |h %></TH>
    <TD COLSPAN=5>
      <% join(', ', grep $_, 
                    $cust_main->spouse_last, $cust_main->spouse_first) %>
    </TD>
  </TR>
%   }
%
%   # invoicing email
%   if ( scalar(@invoicing_list) == 1 ) { # typical individual user; show here
  <TR>
    <TH ALIGN="right"><% mt('Email address') |h %></TH>
    <TD>
      <% $invoicing_list[0] %>
    </TD>
  </TR>
%   } elsif ( scalar(@invoicing_list) > 1 ) {
%   # business customer with a contact list
%   # show nothing here
%
%   } else { # there is no invoice email for them
  <TR>
    <TH ALIGN="right"><% mt('Email address') |h %></TH>
%     if ( !$cust_main->postal_invoice or
%          $conf->exists('cust_main-require_invoicing_list_email',
%                        $cust_main->agentnum)
%     ) {
%       # we need a contact email for this customer (either because that's
%       # policy, or because otherwise they won't receive invoices) but we
%       # don't have one.
    <TD CLASS="error"><% emt('none') %></TD>
%     } else {
    <TD><% emt('no') %></TD>
%     }
%   } # end of invoicing email
 
%   if ( $cust_main->company ) {
  <TR>
    <TH ALIGN="right"><% mt('Company') |h %></TH>
    <TD COLSPAN=7><% $cust_main->company |h %></TD>
  </TR>
%   }
% } elsif ( $this eq 'ship' ) {
%   if ( $cust_main->ship_company ) { # mostly obsolete these days...
  <TR>
    <TD ALIGN="right"><% mt('Company') |h %></TD>
    <TD COLSPAN=7><% $cust_main->ship_company |h %></TD>
  </TR>
%   }
% }


% if ( $location ) { # now the actual address

%   if ( $location->locationname ) {
      <TR>
        <TD ALIGN="right"><% mt('Location ID') |h %></TD>
        <TD COLSPAN=7><% $location->locationname |h %></TD>
      </TR>
%   }

<TR>
  <TH ALIGN="right"><% mt('Address') |h %></TH>
  <TD COLSPAN=7><% $location->address1 |h %></TD>
</TR>

% if ( $location->get('address2') ) {
%   my $address2_label = $conf->exists('cust_main-require_address2') 
%                        ? emt('Unit #')
%                        : ' ';

<TR>
  <TH ALIGN="right"><% $address2_label %></TH>
  <TD COLSPAN=7><% $location->address2 |h %></TD>
</TR>

% } 

<TR>
  <TH></TH>
  <TD COLSPAN=5><% $location->city |h %>\
% if ( $location->county ) {
 (<% $location->county |h %> county)\
% }
<% ($location->city || $location->county) ? ', ' : ''%><% state_label( $location->state, $location->country ) |h %>
  <% $location->zip %>
</TD>
</TR>
<TR>
  <TH></TH>
  <TD><% code2country( $location->country ) %></TD>
</TR>

% if ( $location->latitude && $location->longitude ) {
  <& /elements/tr-coords.html, $location->latitude,
                               $location->longitude,
                               $cust_main->name_short,
                               $cust_main->agentnum,
  &>
% }
<& /elements/tr-censustract.html, $location &>

% }
  
% if ( $this eq 'bill' ) {
%   # billing contact phone numbers
%   foreach my $phone (qw(daytime night mobile)) {
%     next if !$cust_main->get($phone);
<TR>
  <TH ALIGN="right"><% $phone_label{$phone} %></TD>
  <TD COLSPAN=3>
    <& /elements/phonenumber.html,
        $cust_main->get($phone),
        callable => 1,
        calling_list_exempt => $cust_main->calling_list_exempt,
    &>
  </TD>
</TR>

%   } #foreach $phone
%   if ( $cust_main->get('fax') ) {

  <TR>
    <TD ALIGN="right"><% mt('Fax') |h %></TD>
    <TD COLSPAN=3>
      <% $cust_main->get('fax') || '&nbsp;' %>
    </TD>
  </TR>

%   }
%
%   if ( $conf->exists('show_stateid') ) { 

<TR>
    <TD ALIGN="right"><% $stateid_label %></TD>
    <TD><% $cust_main->masked('stateid') || '&nbsp' %></TD>
    <TD ALIGN="right"><% $stateid_state_label %></TD>
    <TD><% $cust_main->stateid_state || '&nbsp' %></TD>
  </TR>

%   }
% } #if $this eq 'bill'
</TABLE>
% if ( @which ) {
<BR>
% }
% } #while @which
<%once>

my %phone_label = (

  'daytime' => ( FS::Msgcat::_gettext('daytime') =~ /^(daytime)?$/
                   ? 'Day&nbsp;Phone'
                   : FS::Msgcat::_gettext('daytime')
               ),

  'night'   => ( FS::Msgcat::_gettext('night') =~ /^(night)?$/
                   ? 'Night&nbsp;Phone'
                   : FS::Msgcat::_gettext('night')
               ),

  'mobile'  => ( FS::Msgcat::_gettext('mobile') =~ /^(mobile)?$/
                   ? 'Mobile&nbsp;Phone'
                   : FS::Msgcat::_gettext('Mobile')
               ),
);

my $stateid_label = FS::Msgcat::_gettext('stateid') =~ /^(stateid)?$/
                      ? 'Driver&rsquo;s&nbsp;License'
                      : FS::Msgcat::_gettext('stateid');
my $stateid_state_label = FS::Msgcat::_gettext('stateid_state') =~ /^(stateid_state)?$/
                      ? 'Driver&rsquo;s&nbsp;License State'
                      : FS::Msgcat::_gettext('stateid_state');

</%once>
<%init>

my $cust_main = shift;
my $conf = new FS::Conf;
my @invoicing_list = $cust_main->invoicing_list_emailonly;

</%init>