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%> <%$style%>> ,
7 <INPUT TYPE="text" NAME="<%$pre%>first" VALUE="<% $cust_main->get($pre.'first') %>" onChange="<% $onchange %>" <%$disabled%> <%$style%>>
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%> <%$style%>>
28 <% include('/elements/location.html',
30 'object' => $cust_main,
31 'onchange' => $onchange,
32 'disabled' => $disabled,
34 'same_checked' => $opt{'same_checked'},
35 'geocode' => $opt{'geocode'},
36 'censustract' => $opt{'censustract'},
41 <TD ALIGN="right"><% $daytime_label %></TD>
43 <INPUT TYPE="text" NAME="<%$pre%>daytime" VALUE="<% $cust_main->get($pre.'daytime') %>" SIZE=18 onChange="<% $onchange %>" <%$disabled%> <%$style%>>
48 <TD ALIGN="right"><% $night_label %></TD>
50 <INPUT TYPE="text" NAME="<%$pre%>night" VALUE="<% $cust_main->get($pre.'night') %>" SIZE=18 onChange="<% $onchange %>" <%$disabled%> <%$style%>>
55 <TD ALIGN="right">Fax</TD>
57 <INPUT TYPE="text" NAME="<%$pre%>fax" VALUE="<% $cust_main->get($pre.'fax') %>" SIZE=12 onChange="<% $onchange %>" <%$disabled%> <%$style%>>
61 % if ( $conf->exists('show_stateid') && !$pre ) {
64 <TD ALIGN="right"><% $stateid_label %></TD>
65 <TD><INPUT TYPE="text" NAME="stateid" VALUE="<% $opt{stateid} %>" SIZE=12 onChange="<% $onchange %>" <%$disabled%> <%$style%>></TD>
66 <TD ALIGN="right"><% $stateid_state_label %></TD>
67 <TD><% include('/elements/select-state.html',
68 'state' => $cust_main->stateid_state,
69 'country' => $cust_main->country,
70 'prefix' => 'stateid_',
71 'onchange' => $onchange,
72 'disabled' => $disabled,
80 <TD><INPUT TYPE="hidden" NAME="stateid" VALUE="<% $opt{stateid} %>"></TD>
81 <TD><INPUT TYPE="hidden" NAME="stateid_state" VALUE="<% $cust_main->stateid_state %>"></TD>
85 <%$r%>required fields<BR>
89 #my( $cust_main, $pre, $onchange, $disabled, %opt ) = @_;
91 my $cust_main = $opt{'cust_main'};
92 my $pre = $opt{'pre'};
93 my $onchange = $opt{'onchange'};
94 my $disabled = $opt{'disabled'};
95 my @style = ( $opt{'style'} ? @{ $opt{'style'} } : () );
97 #push @style, 'background-color: #dddddd' if $disabled;
98 my $style = scalar(@style) ? 'STYLE="'. join(';', @style). '"' : '';
100 my $conf = new FS::Conf;
102 foreach (qw(ss stateid)) {
103 $opt{$_} = $cust_main->masked($_) unless exists $opt{$_};
106 #false laziness with ship state
107 my $countrydefault = $conf->config('countrydefault') || 'US';
108 $cust_main->set($pre.'country', $countrydefault )
109 unless $cust_main->get($pre.'country');
111 my $statedefault = $conf->config('statedefault')
112 || ($countrydefault eq 'US' ? 'CA' : '');
113 $cust_main->set($pre.'state', $statedefault )
114 unless $cust_main->get($pre.'state')
115 || $cust_main->get($pre.'country') ne $countrydefault;
117 $cust_main->set('stateid_state', $cust_main->state )
118 unless $pre || $cust_main->get('stateid_state');
120 $opt{geocode} ||= $cust_main->get('geocode');
122 if ( $conf->exists('cust_main-require_censustract') ) {
123 $opt{censustract} ||= $cust_main->censustract;
126 #my($county_html, $state_html, $country_html) =
127 # FS::cust_main_county::regionselector( $cust_main->get($pre.'county'),
128 # $cust_main->get($pre.'state'),
129 # $cust_main->get($pre.'country'),
135 my $daytime_label = FS::Msgcat::_gettext('daytime') =~ /^(daytime)?$/
137 : FS::Msgcat::_gettext('daytime');
138 my $night_label = FS::Msgcat::_gettext('night') =~/^(night)?$/
140 : FS::Msgcat::_gettext('night') || 'Night Phone';
141 my $stateid_label = FS::Msgcat::_gettext('stateid') =~ /^(stateid)?$/
142 ? 'Driver’s License'
143 : FS::Msgcat::_gettext('stateid') || 'Driver’s License';
144 my $stateid_state_label = FS::Msgcat::_gettext('stateid_state') =~ /^(stateid_state)?$/
145 ? 'Driver’s License State'
146 : FS::Msgcat::_gettext('stateid_state') || 'Driver’s License State';
148 my $r = qq!<font color="#ff0000">*</font> !;