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%>>
29 <TH ALIGN="right"><%$r%>Address</TH>
31 <INPUT TYPE="text" NAME="<%$pre%>address1" VALUE="<% $cust_main->get($pre.'address1') %>" SIZE=70 onChange="<% $onchange %>" <%$disabled%>>
36 <TD ALIGN="right"> </TD>
38 <INPUT TYPE="text" NAME="<%$pre%>address2" VALUE="<% $cust_main->get($pre.'address2') %>" SIZE=70 onChange="<% $onchange %>" <%$disabled%>>
43 <TH ALIGN="right"><%$r%>City</TH>
45 <INPUT TYPE="text" NAME="<%$pre%>city" VALUE="<% $cust_main->get($pre.'city') %>" onChange="<% $onchange %>" <%$disabled%>>
47 <TH ALIGN="right" ID="<%$pre%>countylabel" <%$county_style%>><%$r%>County</TH>
49 <% include('select-county.html', %select_hash ) %>
51 <TH ALIGN="right"><%$r%>State</TH>
53 <% include('select-state.html', %select_hash ) %>
57 <INPUT TYPE="text" NAME="<%$pre%>zip" VALUE="<% $cust_main->get($pre.'zip') %>" SIZE=10 onChange="<% $onchange %>" <%$disabled%>>
62 <TH ALIGN="right"><%$r%>Country</TH>
63 <TD COLSPAN=5><% include('select-country.html', %select_hash ) %></TD>
67 <TD ALIGN="right"><% $daytime_label %></TD>
69 <INPUT TYPE="text" NAME="<%$pre%>daytime" VALUE="<% $cust_main->get($pre.'daytime') %>" SIZE=18 onChange="<% $onchange %>" <%$disabled%>>
74 <TD ALIGN="right"><% $night_label %></TD>
76 <INPUT TYPE="text" NAME="<%$pre%>night" VALUE="<% $cust_main->get($pre.'night') %>" SIZE=18 onChange="<% $onchange %>" <%$disabled%>>
81 <TD ALIGN="right">Fax</TD>
83 <INPUT TYPE="text" NAME="<%$pre%>fax" VALUE="<% $cust_main->get($pre.'fax') %>" SIZE=12 onChange="<% $onchange %>" <%$disabled%>>
87 % if ( $conf->exists('show_stateid') && !$pre ) {
90 <TD ALIGN="right"><% $stateid_label %></TD>
91 <TD><INPUT TYPE="text" NAME="stateid" VALUE="<% $opt{stateid} %>" SIZE=12 onChange="<% $onchange %>" <%$disabled%>></TD>
92 <TD ALIGN="right"><% $stateid_state_label %></TD>
93 <TD><% include('select-state.html', 'state' => $cust_main->stateid_state,
94 'country' => $cust_main->country,
95 'prefix' => 'stateid_',
96 'onchange' => $onchange,
97 'disabled' => $disabled) %></TD>
101 <TD><INPUT TYPE="hidden" NAME="stateid" VALUE="<% $opt{stateid} %>"></TD>
102 <TD><INPUT TYPE="hidden" NAME="stateid_state" VALUE="<% $cust_main->stateid_state %>"></TD>
106 <%$r%>required fields<BR>
110 my( $cust_main, $pre, $onchange, $disabled, %opt ) = @_;
111 my $conf = new FS::Conf;
113 foreach (qw(ss stateid)) {
114 $opt{$_} = $cust_main->masked($_) unless exists $opt{$_};
117 #false laziness with ship state
118 my $countrydefault = $conf->config('countrydefault') || 'US';
119 $cust_main->set($pre.'country', $countrydefault )
120 unless $cust_main->get($pre.'country');
122 my $statedefault = $conf->config('statedefault')
123 || ($countrydefault eq 'US' ? 'CA' : '');
124 $cust_main->set($pre.'state', $statedefault )
125 unless $cust_main->get($pre.'state')
126 || $cust_main->get($pre.'country') ne $countrydefault;
128 $cust_main->set('stateid_state', $cust_main->state )
129 unless $pre || $cust_main->get('stateid_state');
131 #my($county_html, $state_html, $country_html) =
132 # FS::cust_main_county::regionselector( $cust_main->get($pre.'county'),
133 # $cust_main->get($pre.'state'),
134 # $cust_main->get($pre.'country'),
141 'county' => $cust_main->get($pre.'county'),
142 'state' => $cust_main->get($pre.'state'),
143 'country' => $cust_main->get($pre.'country'),
145 'onchange' => $onchange,
146 'disabled' => $disabled,
149 my @counties = counties( $cust_main->get($pre.'state'),
150 $cust_main->get($pre.'country'),
152 my $county_style = scalar(@counties) > 1 ? '' : 'STYLE="visibility:hidden"';
154 my $daytime_label = FS::Msgcat::_gettext('daytime') =~ /^(daytime)?$/
156 : FS::Msgcat::_gettext('daytime');
157 my $night_label = FS::Msgcat::_gettext('night') =~/^(night)?$/
159 : FS::Msgcat::_gettext('night') || 'Night Phone';
160 my $stateid_label = FS::Msgcat::_gettext('stateid') =~ /^(stateid)?$/
161 ? 'Driver’s License'
162 : FS::Msgcat::_gettext('stateid') || 'Driver’s License';
163 my $stateid_state_label = FS::Msgcat::_gettext('stateid_state') =~ /^(stateid_state)?$/
164 ? 'Driver’s License State'
165 : FS::Msgcat::_gettext('stateid_state') || 'Driver’s License State';
167 my $r = qq!<font color="#ff0000">*</font> !;