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>
21 % if ( $conf->exists('cust-email-high-visibility') && !$pre ) {
23 <TD ALIGN="right" WIDTH="200">
24 <% $conf->exists('cust_main-require_invoicing_list_email', $agentnum)
25 ? $r : '' %>Email address(es)
27 <TD bgcolor="#FFFF00">
28 <INPUT TYPE="text" NAME="invoicing_list" VALUE="<% join(', ', grep { $_ !~ /^(POST|FAX)$/ } @invoicing_list ) %>">
33 % unless ( $conf->exists('cust-edit-alt-field-order') ) {
35 <TD ALIGN="right"><% mt('Company') |h %></TD>
37 <INPUT TYPE="text" NAME="<%$pre%>company" VALUE="<% $cust_main->get($pre.'company') |h %>" SIZE=70 onChange="<% $onchange %>" <%$disabled%> <%$style%>>
41 <& /elements/location.html,
43 'object' => $cust_main,
44 'onchange' => $onchange,
45 'disabled' => $disabled,
47 'same_checked' => $opt{'same_checked'},
48 'geocode' => $opt{'geocode'},
49 '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"><% $mobile_label %></TD>
69 <INPUT TYPE="text" NAME="<%$pre%>mobile" VALUE="<% $cust_main->get($pre.'mobile') %>" SIZE=18 onChange="<% $onchange %>" <%$disabled%> <%$style%>>
74 <TD ALIGN="right"><% mt('Fax') |h %></TD>
76 <INPUT TYPE="text" NAME="<%$pre%>fax" VALUE="<% $cust_main->get($pre.'fax') %>" SIZE=12 onChange="<% $onchange %>" <%$disabled%> <%$style%>>
83 <TD ALIGN="right"><% $daytime_label %></TD>
85 <INPUT TYPE="text" NAME="<%$pre%>daytime" VALUE="<% $cust_main->get($pre.'daytime') %>" SIZE=18 onChange="<% $onchange %>" <%$disabled%> <%$style%>>
90 <TD ALIGN="right"><% $night_label %></TD>
92 <INPUT TYPE="text" NAME="<%$pre%>night" VALUE="<% $cust_main->get($pre.'night') %>" SIZE=18 onChange="<% $onchange %>" <%$disabled%> <%$style%>>
97 <TD ALIGN="right"><% $mobile_label %></TD>
99 <INPUT TYPE="text" NAME="<%$pre%>mobile" VALUE="<% $cust_main->get($pre.'mobile') %>" SIZE=18 onChange="<% $onchange %>" <%$disabled%> <%$style%>>
103 <& /elements/location.html,
105 'object' => $cust_main,
106 'onchange' => $onchange,
107 'disabled' => $disabled,
109 'same_checked' => $opt{'same_checked'},
110 'geocode' => $opt{'geocode'},
111 'censustract' => $opt{'censustract'},
115 <TD ALIGN="right"><% mt('Fax') |h %></TD>
117 <INPUT TYPE="text" NAME="<%$pre%>fax" VALUE="<% $cust_main->get($pre.'fax') %>" SIZE=12 onChange="<% $onchange %>" <%$disabled%> <%$style%>>
122 <TD ALIGN="right"><% mt('Company') |h %></TD>
124 <INPUT TYPE="text" NAME="<%$pre%>company" VALUE="<% $cust_main->get($pre.'company') |h %>" SIZE=70 onChange="<% $onchange %>" <%$disabled%> <%$style%>>
130 % if ( $conf->exists('show_stateid') && !$pre ) {
133 <TD ALIGN="right"><% $stateid_label %></TD>
134 <TD><INPUT TYPE="text" NAME="stateid" VALUE="<% $opt{stateid} %>" SIZE=12 onChange="<% $onchange %>" <%$disabled%> <%$style%>></TD>
135 <TD ALIGN="right"><% $stateid_state_label %></TD>
136 <TD><& /elements/select-state.html,
137 'state' => $cust_main->stateid_state,
138 'country' => $cust_main->country,
139 'prefix' => 'stateid_',
140 'onchange' => $onchange,
141 'disabled' => $disabled,
146 % } elsif ( !$pre ) {
148 <TD><INPUT TYPE="hidden" NAME="stateid" VALUE="<% $opt{stateid} %>"></TD>
149 <TD><INPUT TYPE="hidden" NAME="stateid_state" VALUE="<% $cust_main->stateid_state %>"></TD>
153 <%$r%><% mt('required fields') |h %><BR>
158 my $cust_main = $opt{'cust_main'};
159 my $pre = $opt{'pre'};
160 my $onchange = $opt{'onchange'};
161 my $disabled = $opt{'disabled'};
162 my @style = ( $opt{'style'} ? @{ $opt{'style'} } : () );
164 my $style = scalar(@style) ? 'STYLE="'. join(';', @style). '"' : '';
166 my $conf = new FS::Conf;
168 foreach (qw(ss stateid)) {
169 $opt{$_} = $cust_main->masked($_) unless exists $opt{$_};
172 #false laziness with ship state
173 my $countrydefault = $conf->config('countrydefault') || 'US';
174 $cust_main->set($pre.'country', $countrydefault )
175 unless $cust_main->get($pre.'country');
177 my $statedefault = $conf->config('statedefault')
178 || ($countrydefault eq 'US' ? 'CA' : '');
179 $cust_main->set($pre.'state', $statedefault )
180 unless $cust_main->get($pre.'state')
181 || $cust_main->get($pre.'country') ne $countrydefault;
183 $cust_main->set('stateid_state', $cust_main->state )
184 unless $pre || $cust_main->get('stateid_state');
186 $opt{geocode} ||= $cust_main->get('geocode');
188 if ( $conf->exists('cust_main-require_censustract') ) {
189 $opt{censustract} ||= $cust_main->censustract;
192 my $daytime_label = FS::Msgcat::_gettext('daytime') =~ /^(daytime)?$/
194 : FS::Msgcat::_gettext('daytime');
195 my $night_label = FS::Msgcat::_gettext('night') =~/^(night)?$/
197 : FS::Msgcat::_gettext('night') || 'Night Phone';
198 my $mobile_label = FS::Msgcat::_gettext('mobile') =~/^(mobile)?$/
200 : FS::Msgcat::_gettext('mobile') || 'Mobile Phone';
202 my $stateid_label = FS::Msgcat::_gettext('stateid') =~ /^(stateid)?$/
203 ? 'Driver’s License'
204 : FS::Msgcat::_gettext('stateid') || 'Driver’s License';
205 my $stateid_state_label = FS::Msgcat::_gettext('stateid_state') =~ /^(stateid_state)?$/
206 ? 'Driver’s License State'
207 : FS::Msgcat::_gettext('stateid_state') || 'Driver’s License State';
209 my $r = qq!<font color="#ff0000">*</font> !;
211 my @invoicing_list = $cust_main->invoicing_list;
213 my $agentnum = $cust_main->agentnum if $cust_main->custnum;