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 ) %>">
32 % unless ( $conf->exists('cust-edit-alt-field-order') ) {
34 <TD ALIGN="right">Company</TD>
36 <INPUT TYPE="text" NAME="<%$pre%>company" VALUE="<% $cust_main->get($pre.'company') |h %>" SIZE=70 onChange="<% $onchange %>" <%$disabled%> <%$style%>>
40 <% include('/elements/location.html',
42 'object' => $cust_main,
43 'onchange' => $onchange,
44 'disabled' => $disabled,
46 'same_checked' => $opt{'same_checked'},
47 'geocode' => $opt{'geocode'},
48 'censustract' => $opt{'censustract'},
53 <TD ALIGN="right"><% $daytime_label %></TD>
55 <INPUT TYPE="text" NAME="<%$pre%>daytime" VALUE="<% $cust_main->get($pre.'daytime') %>" SIZE=18 onChange="<% $onchange %>" <%$disabled%> <%$style%>>
60 <TD ALIGN="right"><% $night_label %></TD>
62 <INPUT TYPE="text" NAME="<%$pre%>night" VALUE="<% $cust_main->get($pre.'night') %>" SIZE=18 onChange="<% $onchange %>" <%$disabled%> <%$style%>>
67 <TD ALIGN="right">Fax</TD>
69 <INPUT TYPE="text" NAME="<%$pre%>fax" VALUE="<% $cust_main->get($pre.'fax') %>" SIZE=12 onChange="<% $onchange %>" <%$disabled%> <%$style%>>
76 <TD ALIGN="right"><% $daytime_label %></TD>
78 <INPUT TYPE="text" NAME="<%$pre%>daytime" VALUE="<% $cust_main->get($pre.'daytime') %>" SIZE=18 onChange="<% $onchange %>" <%$disabled%> <%$style%>>
83 <TD ALIGN="right"><% $night_label %></TD>
85 <INPUT TYPE="text" NAME="<%$pre%>night" VALUE="<% $cust_main->get($pre.'night') %>" SIZE=18 onChange="<% $onchange %>" <%$disabled%> <%$style%>>
89 <% include('/elements/location.html',
91 'object' => $cust_main,
92 'onchange' => $onchange,
93 'disabled' => $disabled,
95 'same_checked' => $opt{'same_checked'},
96 'geocode' => $opt{'geocode'},
97 'censustract' => $opt{'censustract'},
102 <TD ALIGN="right">Fax</TD>
104 <INPUT TYPE="text" NAME="<%$pre%>fax" VALUE="<% $cust_main->get($pre.'fax') %>" SIZE=12 onChange="<% $onchange %>" <%$disabled%> <%$style%>>
109 <TD ALIGN="right">Company</TD>
111 <INPUT TYPE="text" NAME="<%$pre%>company" VALUE="<% $cust_main->get($pre.'company') |h %>" SIZE=70 onChange="<% $onchange %>" <%$disabled%> <%$style%>>
117 % if ( $conf->exists('show_stateid') && !$pre ) {
120 <TD ALIGN="right"><% $stateid_label %></TD>
121 <TD><INPUT TYPE="text" NAME="stateid" VALUE="<% $opt{stateid} %>" SIZE=12 onChange="<% $onchange %>" <%$disabled%> <%$style%>></TD>
122 <TD ALIGN="right"><% $stateid_state_label %></TD>
123 <TD><% include('/elements/select-state.html',
124 'state' => $cust_main->stateid_state,
125 'country' => $cust_main->country,
126 'prefix' => 'stateid_',
127 'onchange' => $onchange,
128 'disabled' => $disabled,
134 % } elsif ( !$pre ) {
136 <TD><INPUT TYPE="hidden" NAME="stateid" VALUE="<% $opt{stateid} %>"></TD>
137 <TD><INPUT TYPE="hidden" NAME="stateid_state" VALUE="<% $cust_main->stateid_state %>"></TD>
141 <%$r%>required fields<BR>
145 #my( $cust_main, $pre, $onchange, $disabled, %opt ) = @_;
147 my $cust_main = $opt{'cust_main'};
148 my $pre = $opt{'pre'};
149 my $onchange = $opt{'onchange'};
150 my $disabled = $opt{'disabled'};
151 my @style = ( $opt{'style'} ? @{ $opt{'style'} } : () );
153 #push @style, 'background-color: #dddddd' if $disabled;
154 my $style = scalar(@style) ? 'STYLE="'. join(';', @style). '"' : '';
156 my $conf = new FS::Conf;
158 foreach (qw(ss stateid)) {
159 $opt{$_} = $cust_main->masked($_) unless exists $opt{$_};
162 #false laziness with ship state
163 my $countrydefault = $conf->config('countrydefault') || 'US';
164 $cust_main->set($pre.'country', $countrydefault )
165 unless $cust_main->get($pre.'country');
167 my $statedefault = $conf->config('statedefault')
168 || ($countrydefault eq 'US' ? 'CA' : '');
169 $cust_main->set($pre.'state', $statedefault )
170 unless $cust_main->get($pre.'state')
171 || $cust_main->get($pre.'country') ne $countrydefault;
173 $cust_main->set('stateid_state', $cust_main->state )
174 unless $pre || $cust_main->get('stateid_state');
176 $opt{geocode} ||= $cust_main->get('geocode');
178 if ( $conf->exists('cust_main-require_censustract') ) {
179 $opt{censustract} ||= $cust_main->censustract;
182 #my($county_html, $state_html, $country_html) =
183 # FS::cust_main_county::regionselector( $cust_main->get($pre.'county'),
184 # $cust_main->get($pre.'state'),
185 # $cust_main->get($pre.'country'),
191 my $daytime_label = FS::Msgcat::_gettext('daytime') =~ /^(daytime)?$/
193 : FS::Msgcat::_gettext('daytime');
194 my $night_label = FS::Msgcat::_gettext('night') =~/^(night)?$/
196 : FS::Msgcat::_gettext('night') || 'Night Phone';
197 my $stateid_label = FS::Msgcat::_gettext('stateid') =~ /^(stateid)?$/
198 ? 'Driver’s License'
199 : FS::Msgcat::_gettext('stateid') || 'Driver’s License';
200 my $stateid_state_label = FS::Msgcat::_gettext('stateid_state') =~ /^(stateid_state)?$/
201 ? 'Driver’s License State'
202 : FS::Msgcat::_gettext('stateid_state') || 'Driver’s License State';
204 my $r = qq!<font color="#ff0000">*</font> !;
206 my @invoicing_list = $cust_main->invoicing_list;