1 <% &ntable("#cccccc") %>
4 <TH ALIGN="right"><%$r%><% mt('Contact name (last, first)') |h %></TH>
6 <INPUT TYPE="text" NAME="<%$pre%>last" VALUE="<% $cust_main->get($pre.'last') |h %>" onChange="<% $onchange %>" <%$disabled%> <%$style%>> ,
7 <INPUT TYPE="text" NAME="<%$pre%>first" VALUE="<% $cust_main->get($pre.'first') |h %>" onChange="<% $onchange %>" <%$disabled%> <%$style%>>
9 % if ( $conf->exists('show_ss') && !$pre ) {
11 <TD ALIGN="right"><% mt('SS#') |h %></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"><% mt('Company') |h %></TD>
24 <INPUT TYPE="text" NAME="<%$pre%>company" VALUE="<% $cust_main->get($pre.'company') |h %>" SIZE=70 onChange="<% $onchange %>" <%$disabled%> <%$style%>>
28 <& /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'},
40 <TD ALIGN="right"><% $daytime_label %></TD>
42 <INPUT TYPE="text" NAME="<%$pre%>daytime" VALUE="<% $cust_main->get($pre.'daytime') %>" SIZE=18 onChange="<% $onchange %>" <%$disabled%> <%$style%>>
47 <TD ALIGN="right"><% $night_label %></TD>
49 <INPUT TYPE="text" NAME="<%$pre%>night" VALUE="<% $cust_main->get($pre.'night') %>" SIZE=18 onChange="<% $onchange %>" <%$disabled%> <%$style%>>
54 <TD ALIGN="right"><% mt('Fax') |h %></TD>
56 <INPUT TYPE="text" NAME="<%$pre%>fax" VALUE="<% $cust_main->get($pre.'fax') %>" SIZE=12 onChange="<% $onchange %>" <%$disabled%> <%$style%>>
60 % if ( $conf->exists('show_stateid') && !$pre ) {
63 <TD ALIGN="right"><% $stateid_label %></TD>
64 <TD><INPUT TYPE="text" NAME="stateid" VALUE="<% $opt{stateid} %>" SIZE=12 onChange="<% $onchange %>" <%$disabled%> <%$style%>></TD>
65 <TD ALIGN="right"><% $stateid_state_label %></TD>
66 <TD><& /elements/select-state.html,
67 'state' => $cust_main->stateid_state,
68 'country' => $cust_main->country,
69 'prefix' => 'stateid_',
70 'onchange' => $onchange,
71 'disabled' => $disabled,
78 <TD><INPUT TYPE="hidden" NAME="stateid" VALUE="<% $opt{stateid} %>"></TD>
79 <TD><INPUT TYPE="hidden" NAME="stateid_state" VALUE="<% $cust_main->stateid_state %>"></TD>
83 <%$r%><% mt('required fields') |h %><BR>
88 my $cust_main = $opt{'cust_main'};
89 my $pre = $opt{'pre'};
90 my $onchange = $opt{'onchange'};
91 my $disabled = $opt{'disabled'};
92 my @style = ( $opt{'style'} ? @{ $opt{'style'} } : () );
94 my $style = scalar(@style) ? 'STYLE="'. join(';', @style). '"' : '';
96 my $conf = new FS::Conf;
98 foreach (qw(ss stateid)) {
99 $opt{$_} = $cust_main->masked($_) unless exists $opt{$_};
102 #false laziness with ship state
103 my $countrydefault = $conf->config('countrydefault') || 'US';
104 $cust_main->set($pre.'country', $countrydefault )
105 unless $cust_main->get($pre.'country');
107 my $statedefault = $conf->config('statedefault')
108 || ($countrydefault eq 'US' ? 'CA' : '');
109 $cust_main->set($pre.'state', $statedefault )
110 unless $cust_main->get($pre.'state')
111 || $cust_main->get($pre.'country') ne $countrydefault;
113 $cust_main->set('stateid_state', $cust_main->state )
114 unless $pre || $cust_main->get('stateid_state');
116 $opt{geocode} ||= $cust_main->get('geocode');
118 if ( $conf->exists('cust_main-require_censustract') ) {
119 $opt{censustract} ||= $cust_main->censustract;
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> !;