% &ntable("#cccccc") %>
<%$r%>Contact name (last, first) |
> ,
>
|
% if ( $conf->exists('show_ss') && !$pre ) {
SS# |
|
% } elsif ( !$pre ) {
|
% }
Company |
>
|
<%$r%>Address |
>
|
|
>
|
<%$r%>City |
>
|
><%$r%>County |
<% include('select-county.html', %select_hash ) %>
|
<%$r%>State |
<% include('select-state.html', %select_hash ) %>
|
<%$r%>Zip |
>
|
<%$r%>Country |
<% include('select-country.html', %select_hash ) %> |
<% $daytime_label %> |
>
|
<% $night_label %> |
>
|
Fax |
>
|
% if ( $conf->exists('show_stateid') && !$pre ) {
<% $stateid_label %> |
> |
<% $stateid_state_label %> |
<% include('select-state.html', 'state' => $cust_main->stateid_state,
'country' => $cust_main->country,
'prefix' => 'stateid_',
'onchange' => $onchange,
'disabled' => $disabled) %> |
% } elsif ( !$pre ) {
|
|
% }
<%$r%>required fields
<%init>
my( $cust_main, $pre, $onchange, $disabled, %opt ) = @_;
my $conf = new FS::Conf;
foreach (qw(ss stateid)) {
$opt{$_} = $cust_main->masked($_) unless exists $opt{$_};
}
#false laziness with ship state
my $countrydefault = $conf->config('countrydefault') || 'US';
$cust_main->set($pre.'country', $countrydefault )
unless $cust_main->get($pre.'country');
my $statedefault = $conf->config('statedefault')
|| ($countrydefault eq 'US' ? 'CA' : '');
$cust_main->set($pre.'state', $statedefault )
unless $cust_main->get($pre.'state')
|| $cust_main->get($pre.'country') ne $countrydefault;
$cust_main->set('stateid_state', $cust_main->state )
unless $pre || $cust_main->get('stateid_state');
#my($county_html, $state_html, $country_html) =
# FS::cust_main_county::regionselector( $cust_main->get($pre.'county'),
# $cust_main->get($pre.'state'),
# $cust_main->get($pre.'country'),
# $pre,
# $onchange,
# $disabled,
# );
my %select_hash = (
'county' => $cust_main->get($pre.'county'),
'state' => $cust_main->get($pre.'state'),
'country' => $cust_main->get($pre.'country'),
'prefix' => $pre,
'onchange' => $onchange,
'disabled' => $disabled,
);
my @counties = counties( $cust_main->get($pre.'state'),
$cust_main->get($pre.'country'),
);
my $county_style = scalar(@counties) > 1 ? '' : 'STYLE="visibility:hidden"';
my $daytime_label = FS::Msgcat::_gettext('daytime') || 'Day Phone';
my $night_label = FS::Msgcat::_gettext('night') || 'Night Phone';
my $stateid_label = FS::Msgcat::_gettext('stateid') || 'Driver’s License';
my $stateid_state_label = FS::Msgcat::_gettext('stateid_state') || 'Driver’s License State';
my $r = qq!* !;
%init>