1 <% &ntable("#cccccc") %>
4 <TH ALIGN="right"><%$r%>Contact name<BR>(last, first)</TH>
6 <INPUT TYPE="text" NAME="<%$pre%>last" VALUE="<% $cust_main->get($pre.'last') %>" onChange="<% $onchange %>" <%$disabled%>> ,
7 <INPUT TYPE="text" NAME="<%$pre%>first" VALUE="<% $cust_main->get($pre.'first') %>" onChange="<% $onchange %>" <%$disabled%>>
9 % if ( $conf->exists('show_ss') && !$pre ) {
11 <TD ALIGN="right">SS#</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>
22 <TD ALIGN="right">Company</TD>
24 <INPUT TYPE="text" NAME="<%$pre%>company" VALUE="<% $cust_main->get($pre.'company') %>" SIZE=70 onChange="<% $onchange %>" <%$disabled%>>
28 <% include('/elements/location.html',
30 'object' => $cust_main,
31 'onchange' => $onchange,
32 'disabled' => $disabled,
33 'same_checked' => $opt{'same_checked'},
34 'geocode' => $opt{'geocode'},
35 'censustract' => $opt{'censustract'},
40 <TD ALIGN="right"><% $daytime_label %></TD>
42 <INPUT TYPE="text" NAME="<%$pre%>daytime" VALUE="<% $cust_main->get($pre.'daytime') %>" SIZE=18 onChange="<% $onchange %>" <%$disabled%>>
47 <TD ALIGN="right"><% $night_label %></TD>
49 <INPUT TYPE="text" NAME="<%$pre%>night" VALUE="<% $cust_main->get($pre.'night') %>" SIZE=18 onChange="<% $onchange %>" <%$disabled%>>
54 <TD ALIGN="right">Fax</TD>
56 <INPUT TYPE="text" NAME="<%$pre%>fax" VALUE="<% $cust_main->get($pre.'fax') %>" SIZE=12 onChange="<% $onchange %>" <%$disabled%>>
60 % if ( $conf->exists('show_stateid') && !$pre ) {
63 <TD ALIGN="right"><% $stateid_label %></TD>
64 <TD><INPUT TYPE="text" NAME="stateid" VALUE="<% $opt{stateid} %>" SIZE=12 onChange="<% $onchange %>" <%$disabled%>></TD>
65 <TD ALIGN="right"><% $stateid_state_label %></TD>
66 <TD><% include('/elements/select-state.html',
67 'state' => $cust_main->stateid_state,
68 'country' => $cust_main->country,
69 'prefix' => 'stateid_',
70 'onchange' => $onchange,
71 'disabled' => $disabled,
78 <TD><INPUT TYPE="hidden" NAME="stateid" VALUE="<% $opt{stateid} %>"></TD>
79 <TD><INPUT TYPE="hidden" NAME="stateid_state" VALUE="<% $cust_main->stateid_state %>"></TD>
83 <%$r%>required fields<BR>
87 #my( $cust_main, $pre, $onchange, $disabled, %opt ) = @_;
89 my $cust_main = $opt{'cust_main'};
90 my $pre = $opt{'pre'};
91 my $onchange = $opt{'onchange'};
92 my $disabled = $opt{'disabled'};
94 my $conf = new FS::Conf;
96 foreach (qw(ss stateid)) {
97 $opt{$_} = $cust_main->masked($_) unless exists $opt{$_};
100 #false laziness with ship state
101 my $countrydefault = $conf->config('countrydefault') || 'US';
102 $cust_main->set($pre.'country', $countrydefault )
103 unless $cust_main->get($pre.'country');
105 my $statedefault = $conf->config('statedefault')
106 || ($countrydefault eq 'US' ? 'CA' : '');
107 $cust_main->set($pre.'state', $statedefault )
108 unless $cust_main->get($pre.'state')
109 || $cust_main->get($pre.'country') ne $countrydefault;
111 $cust_main->set('stateid_state', $cust_main->state )
112 unless $pre || $cust_main->get('stateid_state');
114 $opt{geocode} ||= $cust_main->get('geocode');
116 if ( $conf->exists('cust_main-require_censustract') ) {
117 $opt{censustract} ||= $cust_main->censustract;
120 #my($county_html, $state_html, $country_html) =
121 # FS::cust_main_county::regionselector( $cust_main->get($pre.'county'),
122 # $cust_main->get($pre.'state'),
123 # $cust_main->get($pre.'country'),
129 my $daytime_label = FS::Msgcat::_gettext('daytime') =~ /^(daytime)?$/
131 : FS::Msgcat::_gettext('daytime');
132 my $night_label = FS::Msgcat::_gettext('night') =~/^(night)?$/
134 : FS::Msgcat::_gettext('night') || 'Night Phone';
135 my $stateid_label = FS::Msgcat::_gettext('stateid') =~ /^(stateid)?$/
136 ? 'Driver’s License'
137 : FS::Msgcat::_gettext('stateid') || 'Driver’s License';
138 my $stateid_state_label = FS::Msgcat::_gettext('stateid_state') =~ /^(stateid_state)?$/
139 ? 'Driver’s License State'
140 : FS::Msgcat::_gettext('stateid_state') || 'Driver’s License State';
142 my $r = qq!<font color="#ff0000">*</font> !;