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>
73 <TD><INPUT TYPE="hidden" NAME="geocode" VALUE="<% $opt{geocode} %>"></TD>
79 <TD ALIGN="right"><% $daytime_label %></TD>
81 <INPUT TYPE="text" NAME="<%$pre%>daytime" VALUE="<% $cust_main->get($pre.'daytime') %>" SIZE=18 onChange="<% $onchange %>" <%$disabled%>>
86 <TD ALIGN="right"><% $night_label %></TD>
88 <INPUT TYPE="text" NAME="<%$pre%>night" VALUE="<% $cust_main->get($pre.'night') %>" SIZE=18 onChange="<% $onchange %>" <%$disabled%>>
93 <TD ALIGN="right">Fax</TD>
95 <INPUT TYPE="text" NAME="<%$pre%>fax" VALUE="<% $cust_main->get($pre.'fax') %>" SIZE=12 onChange="<% $onchange %>" <%$disabled%>>
99 % if ( $conf->exists('show_stateid') && !$pre ) {
102 <TD ALIGN="right"><% $stateid_label %></TD>
103 <TD><INPUT TYPE="text" NAME="stateid" VALUE="<% $opt{stateid} %>" SIZE=12 onChange="<% $onchange %>" <%$disabled%>></TD>
104 <TD ALIGN="right"><% $stateid_state_label %></TD>
105 <TD><% include('select-state.html', 'state' => $cust_main->stateid_state,
106 'country' => $cust_main->country,
107 'prefix' => 'stateid_',
108 'onchange' => $onchange,
109 'disabled' => $disabled) %></TD>
111 % } elsif ( !$pre ) {
113 <TD><INPUT TYPE="hidden" NAME="stateid" VALUE="<% $opt{stateid} %>"></TD>
114 <TD><INPUT TYPE="hidden" NAME="stateid_state" VALUE="<% $cust_main->stateid_state %>"></TD>
118 <%$r%>required fields<BR>
122 #my( $cust_main, $pre, $onchange, $disabled, %opt ) = @_;
124 my $cust_main = $opt{'cust_main'};
125 my $pre = $opt{'pre'};
126 my $onchange = $opt{'onchange'};
127 my $disabled = $opt{'disabled'};
129 my $conf = new FS::Conf;
131 foreach (qw(ss stateid)) {
132 $opt{$_} = $cust_main->masked($_) unless exists $opt{$_};
135 #false laziness with ship state
136 my $countrydefault = $conf->config('countrydefault') || 'US';
137 $cust_main->set($pre.'country', $countrydefault )
138 unless $cust_main->get($pre.'country');
140 my $statedefault = $conf->config('statedefault')
141 || ($countrydefault eq 'US' ? 'CA' : '');
142 $cust_main->set($pre.'state', $statedefault )
143 unless $cust_main->get($pre.'state')
144 || $cust_main->get($pre.'country') ne $countrydefault;
146 $cust_main->set('stateid_state', $cust_main->state )
147 unless $pre || $cust_main->get('stateid_state');
149 #my($county_html, $state_html, $country_html) =
150 # FS::cust_main_county::regionselector( $cust_main->get($pre.'county'),
151 # $cust_main->get($pre.'state'),
152 # $cust_main->get($pre.'country'),
159 'county' => $cust_main->get($pre.'county'),
160 'state' => $cust_main->get($pre.'state'),
161 'country' => $cust_main->get($pre.'country'),
163 'onchange' => $onchange,
164 'disabled' => $disabled,
167 my @counties = counties( $cust_main->get($pre.'state'),
168 $cust_main->get($pre.'country'),
170 my $county_style = scalar(@counties) > 1 ? '' : 'STYLE="visibility:hidden"';
172 my $daytime_label = FS::Msgcat::_gettext('daytime') =~ /^(daytime)?$/
174 : FS::Msgcat::_gettext('daytime');
175 my $night_label = FS::Msgcat::_gettext('night') =~/^(night)?$/
177 : FS::Msgcat::_gettext('night') || 'Night Phone';
178 my $stateid_label = FS::Msgcat::_gettext('stateid') =~ /^(stateid)?$/
179 ? 'Driver’s License'
180 : FS::Msgcat::_gettext('stateid') || 'Driver’s License';
181 my $stateid_state_label = FS::Msgcat::_gettext('stateid_state') =~ /^(stateid_state)?$/
182 ? 'Driver’s License State'
183 : FS::Msgcat::_gettext('stateid_state') || 'Driver’s License State';
185 my $r = qq!<font color="#ff0000">*</font> !;