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') |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">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>
21 % if ( $conf->exists('cust-email-high-visibility') && !$pre ) {
23 <TD ALIGN="right" WIDTH="200">
24 <% $conf->exists('cust_main-require_invoicing_list_email') ? $r : '' %>Email address(es)
26 <TD bgcolor="#FFFF00">
27 <INPUT TYPE="text" NAME="invoicing_list" VALUE="<% join(', ', grep { $_ !~ /^(POST|FAX)$/ } @invoicing_list ) %>">
33 <TD ALIGN="right">Company</TD>
35 <INPUT TYPE="text" NAME="<%$pre%>company" VALUE="<% $cust_main->get($pre.'company') |h %>" SIZE=70 onChange="<% $onchange %>" <%$disabled%> <%$style%>>
39 <% include('/elements/location.html',
41 'object' => $cust_main,
42 'onchange' => $onchange,
43 'disabled' => $disabled,
45 'same_checked' => $opt{'same_checked'},
46 'geocode' => $opt{'geocode'},
47 'censustract' => $opt{'censustract'},
52 <TD ALIGN="right"><% $daytime_label %></TD>
54 <INPUT TYPE="text" NAME="<%$pre%>daytime" VALUE="<% $cust_main->get($pre.'daytime') %>" SIZE=18 onChange="<% $onchange %>" <%$disabled%> <%$style%>>
59 <TD ALIGN="right"><% $night_label %></TD>
61 <INPUT TYPE="text" NAME="<%$pre%>night" VALUE="<% $cust_main->get($pre.'night') %>" SIZE=18 onChange="<% $onchange %>" <%$disabled%> <%$style%>>
66 <TD ALIGN="right">Fax</TD>
68 <INPUT TYPE="text" NAME="<%$pre%>fax" VALUE="<% $cust_main->get($pre.'fax') %>" SIZE=12 onChange="<% $onchange %>" <%$disabled%> <%$style%>>
72 % if ( $conf->exists('show_stateid') && !$pre ) {
75 <TD ALIGN="right"><% $stateid_label %></TD>
76 <TD><INPUT TYPE="text" NAME="stateid" VALUE="<% $opt{stateid} %>" SIZE=12 onChange="<% $onchange %>" <%$disabled%> <%$style%>></TD>
77 <TD ALIGN="right"><% $stateid_state_label %></TD>
78 <TD><% include('/elements/select-state.html',
79 'state' => $cust_main->stateid_state,
80 'country' => $cust_main->country,
81 'prefix' => 'stateid_',
82 'onchange' => $onchange,
83 'disabled' => $disabled,
91 <TD><INPUT TYPE="hidden" NAME="stateid" VALUE="<% $opt{stateid} %>"></TD>
92 <TD><INPUT TYPE="hidden" NAME="stateid_state" VALUE="<% $cust_main->stateid_state %>"></TD>
96 <%$r%>required fields<BR>
100 #my( $cust_main, $pre, $onchange, $disabled, %opt ) = @_;
102 my $cust_main = $opt{'cust_main'};
103 my $pre = $opt{'pre'};
104 my $onchange = $opt{'onchange'};
105 my $disabled = $opt{'disabled'};
106 my @style = ( $opt{'style'} ? @{ $opt{'style'} } : () );
108 #push @style, 'background-color: #dddddd' if $disabled;
109 my $style = scalar(@style) ? 'STYLE="'. join(';', @style). '"' : '';
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 $opt{geocode} ||= $cust_main->get('geocode');
133 if ( $conf->exists('cust_main-require_censustract') ) {
134 $opt{censustract} ||= $cust_main->censustract;
137 #my($county_html, $state_html, $country_html) =
138 # FS::cust_main_county::regionselector( $cust_main->get($pre.'county'),
139 # $cust_main->get($pre.'state'),
140 # $cust_main->get($pre.'country'),
146 my $daytime_label = FS::Msgcat::_gettext('daytime') =~ /^(daytime)?$/
148 : FS::Msgcat::_gettext('daytime');
149 my $night_label = FS::Msgcat::_gettext('night') =~/^(night)?$/
151 : FS::Msgcat::_gettext('night') || 'Night Phone';
152 my $stateid_label = FS::Msgcat::_gettext('stateid') =~ /^(stateid)?$/
153 ? 'Driver’s License'
154 : FS::Msgcat::_gettext('stateid') || 'Driver’s License';
155 my $stateid_state_label = FS::Msgcat::_gettext('stateid_state') =~ /^(stateid_state)?$/
156 ? 'Driver’s License State'
157 : FS::Msgcat::_gettext('stateid_state') || 'Driver’s License State';
159 my $r = qq!<font color="#ff0000">*</font> !;
161 my @invoicing_list = $cust_main->invoicing_list;