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%>>
35 % my $address2_label_style =
37 % || ! $conf->exists('cust_main-require_address2')
38 % || ( !$pre && !$opt{'same_checked'} )
40 % ? 'visibility:hidden'
44 <TD ALIGN="right"><FONT ID="<% $pre %>address2_required" color="#ff0000" STYLE="<% $address2_label_style %>">*</FONT> <FONT ID="<% $pre %>address2_label" STYLE="<% $address2_label_style %>"><B>Unit #</B></FONT></TD>
46 <INPUT TYPE="text" NAME="<%$pre%>address2" VALUE="<% $cust_main->get($pre.'address2') %>" SIZE=70 onChange="<% $onchange %>" <%$disabled%>>
51 <TH ALIGN="right"><%$r%>City</TH>
53 <INPUT TYPE="text" NAME="<%$pre%>city" VALUE="<% $cust_main->get($pre.'city') %>" onChange="<% $onchange %>" <%$disabled%>>
55 <TH ALIGN="right" ID="<%$pre%>countylabel" <%$county_style%>><%$r%>County</TH>
57 <% include('select-county.html', %select_hash ) %>
59 <TH ALIGN="right"><%$r%>State</TH>
61 <% include('select-state.html', %select_hash ) %>
65 <INPUT TYPE="text" NAME="<%$pre%>zip" VALUE="<% $cust_main->get($pre.'zip') %>" SIZE=10 onChange="<% $onchange %>" <%$disabled%>>
70 <TH ALIGN="right"><%$r%>Country</TH>
71 <TD COLSPAN=5><% include('select-country.html', %select_hash ) %></TD>
75 <TD ALIGN="right"><% $daytime_label %></TD>
77 <INPUT TYPE="text" NAME="<%$pre%>daytime" VALUE="<% $cust_main->get($pre.'daytime') %>" SIZE=18 onChange="<% $onchange %>" <%$disabled%>>
82 <TD ALIGN="right"><% $night_label %></TD>
84 <INPUT TYPE="text" NAME="<%$pre%>night" VALUE="<% $cust_main->get($pre.'night') %>" SIZE=18 onChange="<% $onchange %>" <%$disabled%>>
89 <TD ALIGN="right">Fax</TD>
91 <INPUT TYPE="text" NAME="<%$pre%>fax" VALUE="<% $cust_main->get($pre.'fax') %>" SIZE=12 onChange="<% $onchange %>" <%$disabled%>>
95 % if ( $conf->exists('show_stateid') && !$pre ) {
98 <TD ALIGN="right"><% $stateid_label %></TD>
99 <TD><INPUT TYPE="text" NAME="stateid" VALUE="<% $opt{stateid} %>" SIZE=12 onChange="<% $onchange %>" <%$disabled%>></TD>
100 <TD ALIGN="right"><% $stateid_state_label %></TD>
101 <TD><% include('select-state.html', 'state' => $cust_main->stateid_state,
102 'country' => $cust_main->country,
103 'prefix' => 'stateid_',
104 'onchange' => $onchange,
105 'disabled' => $disabled) %></TD>
107 % } elsif ( !$pre ) {
109 <TD><INPUT TYPE="hidden" NAME="stateid" VALUE="<% $opt{stateid} %>"></TD>
110 <TD><INPUT TYPE="hidden" NAME="stateid_state" VALUE="<% $cust_main->stateid_state %>"></TD>
114 <%$r%>required fields<BR>
118 #my( $cust_main, $pre, $onchange, $disabled, %opt ) = @_;
120 my $cust_main = $opt{'cust_main'};
121 my $pre = $opt{'pre'};
122 my $onchange = $opt{'onchange'};
123 my $disabled = $opt{'disabled'};
125 my $conf = new FS::Conf;
127 foreach (qw(ss stateid)) {
128 $opt{$_} = $cust_main->masked($_) unless exists $opt{$_};
131 #false laziness with ship state
132 my $countrydefault = $conf->config('countrydefault') || 'US';
133 $cust_main->set($pre.'country', $countrydefault )
134 unless $cust_main->get($pre.'country');
136 my $statedefault = $conf->config('statedefault')
137 || ($countrydefault eq 'US' ? 'CA' : '');
138 $cust_main->set($pre.'state', $statedefault )
139 unless $cust_main->get($pre.'state')
140 || $cust_main->get($pre.'country') ne $countrydefault;
142 $cust_main->set('stateid_state', $cust_main->state )
143 unless $pre || $cust_main->get('stateid_state');
145 #my($county_html, $state_html, $country_html) =
146 # FS::cust_main_county::regionselector( $cust_main->get($pre.'county'),
147 # $cust_main->get($pre.'state'),
148 # $cust_main->get($pre.'country'),
155 'county' => $cust_main->get($pre.'county'),
156 'state' => $cust_main->get($pre.'state'),
157 'country' => $cust_main->get($pre.'country'),
159 'onchange' => $onchange,
160 'disabled' => $disabled,
163 my @counties = counties( $cust_main->get($pre.'state'),
164 $cust_main->get($pre.'country'),
166 my $county_style = scalar(@counties) > 1 ? '' : 'STYLE="visibility:hidden"';
168 my $daytime_label = FS::Msgcat::_gettext('daytime') =~ /^(daytime)?$/
170 : FS::Msgcat::_gettext('daytime');
171 my $night_label = FS::Msgcat::_gettext('night') =~/^(night)?$/
173 : FS::Msgcat::_gettext('night') || 'Night Phone';
174 my $stateid_label = FS::Msgcat::_gettext('stateid') =~ /^(stateid)?$/
175 ? 'Driver’s License'
176 : FS::Msgcat::_gettext('stateid') || 'Driver’s License';
177 my $stateid_state_label = FS::Msgcat::_gettext('stateid_state') =~ /^(stateid_state)?$/
178 ? 'Driver’s License State'
179 : FS::Msgcat::_gettext('stateid_state') || 'Driver’s License State';
181 my $r = qq!<font color="#ff0000">*</font> !;