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'},
39 <TD ALIGN="right"><% $daytime_label %></TD>
41 <INPUT TYPE="text" NAME="<%$pre%>daytime" VALUE="<% $cust_main->get($pre.'daytime') %>" SIZE=18 onChange="<% $onchange %>" <%$disabled%>>
46 <TD ALIGN="right"><% $night_label %></TD>
48 <INPUT TYPE="text" NAME="<%$pre%>night" VALUE="<% $cust_main->get($pre.'night') %>" SIZE=18 onChange="<% $onchange %>" <%$disabled%>>
53 <TD ALIGN="right">Fax</TD>
55 <INPUT TYPE="text" NAME="<%$pre%>fax" VALUE="<% $cust_main->get($pre.'fax') %>" SIZE=12 onChange="<% $onchange %>" <%$disabled%>>
59 % if ( $conf->exists('show_stateid') && !$pre ) {
62 <TD ALIGN="right"><% $stateid_label %></TD>
63 <TD><INPUT TYPE="text" NAME="stateid" VALUE="<% $opt{stateid} %>" SIZE=12 onChange="<% $onchange %>" <%$disabled%>></TD>
64 <TD ALIGN="right"><% $stateid_state_label %></TD>
65 <TD><% include('/elements/select-state.html',
66 'state' => $cust_main->stateid_state,
67 'country' => $cust_main->country,
68 'prefix' => 'stateid_',
69 'onchange' => $onchange,
70 'disabled' => $disabled,
77 <TD><INPUT TYPE="hidden" NAME="stateid" VALUE="<% $opt{stateid} %>"></TD>
78 <TD><INPUT TYPE="hidden" NAME="stateid_state" VALUE="<% $cust_main->stateid_state %>"></TD>
82 <%$r%>required fields<BR>
86 #my( $cust_main, $pre, $onchange, $disabled, %opt ) = @_;
88 my $cust_main = $opt{'cust_main'};
89 my $pre = $opt{'pre'};
90 my $onchange = $opt{'onchange'};
91 my $disabled = $opt{'disabled'};
93 my $conf = new FS::Conf;
95 foreach (qw(ss stateid)) {
96 $opt{$_} = $cust_main->masked($_) unless exists $opt{$_};
99 #false laziness with ship state
100 my $countrydefault = $conf->config('countrydefault') || 'US';
101 $cust_main->set($pre.'country', $countrydefault )
102 unless $cust_main->get($pre.'country');
104 my $statedefault = $conf->config('statedefault')
105 || ($countrydefault eq 'US' ? 'CA' : '');
106 $cust_main->set($pre.'state', $statedefault )
107 unless $cust_main->get($pre.'state')
108 || $cust_main->get($pre.'country') ne $countrydefault;
110 $cust_main->set('stateid_state', $cust_main->state )
111 unless $pre || $cust_main->get('stateid_state');
113 #my($county_html, $state_html, $country_html) =
114 # FS::cust_main_county::regionselector( $cust_main->get($pre.'county'),
115 # $cust_main->get($pre.'state'),
116 # $cust_main->get($pre.'country'),
122 my $daytime_label = FS::Msgcat::_gettext('daytime') =~ /^(daytime)?$/
124 : FS::Msgcat::_gettext('daytime');
125 my $night_label = FS::Msgcat::_gettext('night') =~/^(night)?$/
127 : FS::Msgcat::_gettext('night') || 'Night Phone';
128 my $stateid_label = FS::Msgcat::_gettext('stateid') =~ /^(stateid)?$/
129 ? 'Driver’s License'
130 : FS::Msgcat::_gettext('stateid') || 'Driver’s License';
131 my $stateid_state_label = FS::Msgcat::_gettext('stateid_state') =~ /^(stateid_state)?$/
132 ? 'Driver’s License State'
133 : FS::Msgcat::_gettext('stateid_state') || 'Driver’s License State';
135 my $r = qq!<font color="#ff0000">*</font> !;