1 <% &ntable("#cccccc") %>
4 <TH ALIGN="right"><%$r%><% mt('Contact name (last, first)') |h %></TH>
6 <INPUT TYPE="text" NAME="<%$pre%>last" VALUE="<% $cust_main->get($pre.'last') |h %>" onChange="<% $onchange %>" <%$disabled%> <%$style%>> ,
7 <INPUT TYPE="text" NAME="<%$pre%>first" VALUE="<% $cust_main->get($pre.'first') |h %>" onChange="<% $onchange %>" <%$disabled%> <%$style%>>
9 % if ( $conf->exists('show_ss') && !$pre ) {
11 <TD ALIGN="right"><% mt('SS#') |h %></TD>
12 <TD><INPUT TYPE="text" NAME="ss" VALUE="<% $opt{ss} %>" SIZE=11></TD>
15 <TD><INPUT TYPE="hidden" NAME="ss" VALUE="<% $opt{ss} %>"></TD>
21 % if ( $conf->exists('cust-email-high-visibility') && !$pre ) {
23 <TD ALIGN="right" WIDTH="200">
24 <% $conf->exists('cust_main-require_invoicing_list_email') ? $r : '' %>Email address(es)
26 <TD bgcolor="#FFFF00">
27 <INPUT TYPE="text" NAME="invoicing_list" VALUE="<% join(', ', grep { $_ !~ /^(POST|FAX)$/ } @invoicing_list ) %>">
32 % unless ( $conf->exists('cust-edit-alt-field-order') ) {
34 <TD ALIGN="right"><% mt('Company') |h %></TD>
36 <INPUT TYPE="text" NAME="<%$pre%>company" VALUE="<% $cust_main->get($pre.'company') |h %>" SIZE=70 onChange="<% $onchange %>" <%$disabled%> <%$style%>>
40 <& /elements/location.html,
42 'object' => $cust_main,
43 'onchange' => $onchange,
44 'disabled' => $disabled,
46 'same_checked' => $opt{'same_checked'},
47 'geocode' => $opt{'geocode'},
48 'censustract' => $opt{'censustract'},
52 <TD ALIGN="right"><% $daytime_label %></TD>
54 <INPUT TYPE="text" NAME="<%$pre%>daytime" VALUE="<% $cust_main->get($pre.'daytime') %>" SIZE=18 onChange="<% $onchange %>" <%$disabled%> <%$style%>>
59 <TD ALIGN="right"><% $night_label %></TD>
61 <INPUT TYPE="text" NAME="<%$pre%>night" VALUE="<% $cust_main->get($pre.'night') %>" SIZE=18 onChange="<% $onchange %>" <%$disabled%> <%$style%>>
66 <TD ALIGN="right"><% $mobile_label %></TD>
68 <INPUT TYPE="text" NAME="<%$pre%>mobile" VALUE="<% $cust_main->get($pre.'mobile') %>" SIZE=18 onChange="<% $onchange %>" <%$disabled%> <%$style%>>
73 <TD ALIGN="right"><% mt('Fax') |h %></TD>
75 <INPUT TYPE="text" NAME="<%$pre%>fax" VALUE="<% $cust_main->get($pre.'fax') %>" SIZE=12 onChange="<% $onchange %>" <%$disabled%> <%$style%>>
82 <TD ALIGN="right"><% $daytime_label %></TD>
84 <INPUT TYPE="text" NAME="<%$pre%>daytime" VALUE="<% $cust_main->get($pre.'daytime') %>" SIZE=18 onChange="<% $onchange %>" <%$disabled%> <%$style%>>
89 <TD ALIGN="right"><% $night_label %></TD>
91 <INPUT TYPE="text" NAME="<%$pre%>night" VALUE="<% $cust_main->get($pre.'night') %>" SIZE=18 onChange="<% $onchange %>" <%$disabled%> <%$style%>>
96 <TD ALIGN="right"><% $mobile_label %></TD>
98 <INPUT TYPE="text" NAME="<%$pre%>mobile" VALUE="<% $cust_main->get($pre.'mobile') %>" SIZE=18 onChange="<% $onchange %>" <%$disabled%> <%$style%>>
102 <& /elements/location.html,
104 'object' => $cust_main,
105 'onchange' => $onchange,
106 'disabled' => $disabled,
108 'same_checked' => $opt{'same_checked'},
109 'geocode' => $opt{'geocode'},
110 'censustract' => $opt{'censustract'},
114 <TD ALIGN="right"><% mt('Fax') |h %></TD>
116 <INPUT TYPE="text" NAME="<%$pre%>fax" VALUE="<% $cust_main->get($pre.'fax') %>" SIZE=12 onChange="<% $onchange %>" <%$disabled%> <%$style%>>
121 <TD ALIGN="right"><% mt('Company') |h %></TD>
123 <INPUT TYPE="text" NAME="<%$pre%>company" VALUE="<% $cust_main->get($pre.'company') |h %>" SIZE=70 onChange="<% $onchange %>" <%$disabled%> <%$style%>>
129 % if ( $conf->exists('show_stateid') && !$pre ) {
132 <TD ALIGN="right"><% $stateid_label %></TD>
133 <TD><INPUT TYPE="text" NAME="stateid" VALUE="<% $opt{stateid} %>" SIZE=12 onChange="<% $onchange %>" <%$disabled%> <%$style%>></TD>
134 <TD ALIGN="right"><% $stateid_state_label %></TD>
135 <TD><& /elements/select-state.html,
136 'state' => $cust_main->stateid_state,
137 'country' => $cust_main->country,
138 'prefix' => 'stateid_',
139 'onchange' => $onchange,
140 'disabled' => $disabled,
145 % } elsif ( !$pre ) {
147 <TD><INPUT TYPE="hidden" NAME="stateid" VALUE="<% $opt{stateid} %>"></TD>
148 <TD><INPUT TYPE="hidden" NAME="stateid_state" VALUE="<% $cust_main->stateid_state %>"></TD>
152 <%$r%><% mt('required fields') |h %><BR>
157 my $cust_main = $opt{'cust_main'};
158 my $pre = $opt{'pre'};
159 my $onchange = $opt{'onchange'};
160 my $disabled = $opt{'disabled'};
161 my @style = ( $opt{'style'} ? @{ $opt{'style'} } : () );
163 my $style = scalar(@style) ? 'STYLE="'. join(';', @style). '"' : '';
165 my $conf = new FS::Conf;
167 foreach (qw(ss stateid)) {
168 $opt{$_} = $cust_main->masked($_) unless exists $opt{$_};
171 #false laziness with ship state
172 my $countrydefault = $conf->config('countrydefault') || 'US';
173 $cust_main->set($pre.'country', $countrydefault )
174 unless $cust_main->get($pre.'country');
176 my $statedefault = $conf->config('statedefault')
177 || ($countrydefault eq 'US' ? 'CA' : '');
178 $cust_main->set($pre.'state', $statedefault )
179 unless $cust_main->get($pre.'state')
180 || $cust_main->get($pre.'country') ne $countrydefault;
182 $cust_main->set('stateid_state', $cust_main->state )
183 unless $pre || $cust_main->get('stateid_state');
185 $opt{geocode} ||= $cust_main->get('geocode');
187 if ( $conf->exists('cust_main-require_censustract') ) {
188 $opt{censustract} ||= $cust_main->censustract;
191 my $daytime_label = FS::Msgcat::_gettext('daytime') =~ /^(daytime)?$/
193 : FS::Msgcat::_gettext('daytime');
194 my $night_label = FS::Msgcat::_gettext('night') =~/^(night)?$/
196 : FS::Msgcat::_gettext('night') || 'Night Phone';
197 my $mobile_label = FS::Msgcat::_gettext('mobile') =~/^(mobile)?$/
199 : FS::Msgcat::_gettext('mobile') || 'Mobile Phone';
201 my $stateid_label = FS::Msgcat::_gettext('stateid') =~ /^(stateid)?$/
202 ? 'Driver’s License'
203 : FS::Msgcat::_gettext('stateid') || 'Driver’s License';
204 my $stateid_state_label = FS::Msgcat::_gettext('stateid_state') =~ /^(stateid_state)?$/
205 ? 'Driver’s License State'
206 : FS::Msgcat::_gettext('stateid_state') || 'Driver’s License State';
208 my $r = qq!<font color="#ff0000">*</font> !;
210 my @invoicing_list = $cust_main->invoicing_list;