-<% &ntable("#cccccc") %>
+<TABLE CLASS="fsinnerbox">
<TR>
<TH ALIGN="right"><%$r%><% mt('Contact name (last, first)') |h %></TH>
<TD><INPUT TYPE="hidden" NAME="ss" VALUE="<% $opt{ss} %>"></TD>
% }
-
-
</TR>
% if ( $conf->exists('cust-email-high-visibility') && !$pre ) {
<TR>
<TD ALIGN="right" WIDTH="200">
- <% $conf->exists('cust_main-require_invoicing_list_email') ? $r : '' %>Email address(es)
+ <% $conf->exists('cust_main-require_invoicing_list_email', $agentnum)
+ ? $r : '' %>Email address(es)
</TD>
<TD bgcolor="#FFFF00">
<INPUT TYPE="text" NAME="invoicing_list" VALUE="<% join(', ', grep { $_ !~ /^(POST|FAX)$/ } @invoicing_list ) %>">
</TR>
% }
-% unless ( $conf->exists('cust-edit-alt-field-order') ) {
-<TR>
- <TD ALIGN="right"><% mt('Company') |h %></TD>
- <TD COLSPAN=7>
- <INPUT TYPE="text" NAME="<%$pre%>company" VALUE="<% $cust_main->get($pre.'company') |h %>" SIZE=70 onChange="<% $onchange %>" <%$disabled%> <%$style%>>
- </TD>
-</TR>
+% unless ( $conf->exists('cust-edit-alt-field-order') ) { #standard order
-<& /elements/location.html,
- 'prefix' => $pre,
- 'object' => $cust_main,
- 'onchange' => $onchange,
- 'disabled' => $disabled,
- 'style' => \@style,
- 'same_checked' => $opt{'same_checked'},
- 'geocode' => $opt{'geocode'},
- 'censustract' => $opt{'censustract'},
-&>
+ <& company &>
+ <& location &>
+ <& phones &>
+ <& fax &>
-<TR>
- <TD ALIGN="right"><% $daytime_label %></TD>
- <TD COLSPAN=5>
- <INPUT TYPE="text" NAME="<%$pre%>daytime" VALUE="<% $cust_main->get($pre.'daytime') %>" SIZE=18 onChange="<% $onchange %>" <%$disabled%> <%$style%>>
- </TD>
-</TR>
+% } else { #alternate field order
-<TR>
- <TD ALIGN="right"><% $night_label %></TD>
- <TD COLSPAN=5>
- <INPUT TYPE="text" NAME="<%$pre%>night" VALUE="<% $cust_main->get($pre.'night') %>" SIZE=18 onChange="<% $onchange %>" <%$disabled%> <%$style%>>
- </TD>
-</TR>
-
-<TR>
- <TD ALIGN="right"><% $mobile_label %></TD>
- <TD COLSPAN=5>
- <INPUT TYPE="text" NAME="<%$pre%>mobile" VALUE="<% $cust_main->get($pre.'mobile') %>" SIZE=18 onChange="<% $onchange %>" <%$disabled%> <%$style%>>
- </TD>
-</TR>
-
-<TR>
- <TD ALIGN="right"><% mt('Fax') |h %></TD>
- <TD COLSPAN=5>
- <INPUT TYPE="text" NAME="<%$pre%>fax" VALUE="<% $cust_main->get($pre.'fax') %>" SIZE=12 onChange="<% $onchange %>" <%$disabled%> <%$style%>>
- </TD>
-</TR>
-
-% } else {
-
-<TR>
- <TD ALIGN="right"><% $daytime_label %></TD>
- <TD COLSPAN=5>
- <INPUT TYPE="text" NAME="<%$pre%>daytime" VALUE="<% $cust_main->get($pre.'daytime') %>" SIZE=18 onChange="<% $onchange %>" <%$disabled%> <%$style%>>
- </TD>
-</TR>
-
-<TR>
- <TD ALIGN="right"><% $night_label %></TD>
- <TD COLSPAN=5>
- <INPUT TYPE="text" NAME="<%$pre%>night" VALUE="<% $cust_main->get($pre.'night') %>" SIZE=18 onChange="<% $onchange %>" <%$disabled%> <%$style%>>
- </TD>
-</TR>
-
-<TR>
- <TD ALIGN="right"><% $mobile_label %></TD>
- <TD COLSPAN=5>
- <INPUT TYPE="text" NAME="<%$pre%>mobile" VALUE="<% $cust_main->get($pre.'mobile') %>" SIZE=18 onChange="<% $onchange %>" <%$disabled%> <%$style%>>
- </TD>
-</TR>
-
-<& /elements/location.html,
- 'prefix' => $pre,
- 'object' => $cust_main,
- 'onchange' => $onchange,
- 'disabled' => $disabled,
- 'style' => \@style,
- 'same_checked' => $opt{'same_checked'},
- 'geocode' => $opt{'geocode'},
- 'censustract' => $opt{'censustract'},
-&>
-
-<TR>
- <TD ALIGN="right"><% mt('Fax') |h %></TD>
- <TD COLSPAN=5>
- <INPUT TYPE="text" NAME="<%$pre%>fax" VALUE="<% $cust_main->get($pre.'fax') %>" SIZE=12 onChange="<% $onchange %>" <%$disabled%> <%$style%>>
- </TD>
-</TR>
-
-<TR>
- <TD ALIGN="right"><% mt('Company') |h %></TD>
- <TD COLSPAN=7>
- <INPUT TYPE="text" NAME="<%$pre%>company" VALUE="<% $cust_main->get($pre.'company') |h %>" SIZE=70 onChange="<% $onchange %>" <%$disabled%> <%$style%>>
- </TD>
-</TR>
+ <& phones &>
+ <& location &>
+ <& fax &>
+ <& company &>
% }
</TABLE>
<%$r%><% mt('required fields') |h %><BR>
+<%def company>
+% my $display = ($cust_main->residential_commercial eq 'Commercial')
+% ? '' : 'none';
+ <TR ID="<%$pre%>company_row" STYLE="display:<%$display%>">
+ <TD ALIGN="right"><% mt('Company') |h %></TD>
+ <TD COLSPAN=7>
+ <INPUT TYPE="text" NAME="<%$pre%>company" ID="<%$pre%>company" VALUE="<% $cust_main->get($pre.'company') |h %>" SIZE=60 onChange="<% $onchange %>" <%$disabled%> <%$style%>>
+ </TD>
+ </TR>
+</%def>
+
+<%def location>
+ <& /elements/location.html,
+ 'prefix' => $pre,
+ 'object' => $cust_main,
+ 'onchange' => $onchange,
+ 'disabled' => $disabled,
+ 'style' => \@style,
+ 'same_checked' => $opt{'same_checked'},
+ 'geocode' => $opt{'geocode'},
+ 'censustract' => $opt{'censustract'},
+ &>
+</%def>
+
+<%def phones>
+ <& /elements/tr-cust_main-phones.html,
+ 'prefix' => $pre,
+ 'cust_main' => $cust_main,
+ 'onchange' => $onchange,
+ 'disabled' => $disabled,
+ 'style' => $style,
+ &>
+</%def>
+
+<%def fax>
+ <TR>
+ <TD ALIGN="right"><% mt('Fax') |h %></TD>
+ <TD COLSPAN=5>
+ <INPUT TYPE="text" NAME="<%$pre%>fax" VALUE="<% $cust_main->get($pre.'fax') %>" SIZE=12 onChange="<% $onchange %>" <%$disabled%> <%$style%>>
+ </TD>
+ </TR>
+</%def>
+
+<%once>
+
+my $r = qq!<font color="#ff0000">*</font> !;
+
+</%once>
+<%shared>
+
+my( %opt, $cust_main, $pre, $onchange, $disabled, @style, $style );
+
+</%shared>
<%init>
-my %opt = @_;
-my $cust_main = $opt{'cust_main'};
-my $pre = $opt{'pre'};
-my $onchange = $opt{'onchange'};
-my $disabled = $opt{'disabled'};
-my @style = ( $opt{'style'} ? @{ $opt{'style'} } : () );
+%opt = @_;
+$cust_main = $opt{'cust_main'};
+$pre = $opt{'pre'};
+$onchange = $opt{'onchange'};
+$disabled = $opt{'disabled'};
+@style = ( $opt{'style'} ? @{ $opt{'style'} } : () );
-my $style = scalar(@style) ? 'STYLE="'. join(';', @style). '"' : '';
+$style = scalar(@style) ? 'STYLE="'. join(';', @style). '"' : '';
my $conf = new FS::Conf;
$opt{geocode} ||= $cust_main->get('geocode');
-if ( $conf->exists('cust_main-require_censustract') ) {
- $opt{censustract} ||= $cust_main->censustract;
-}
-
-my $daytime_label = FS::Msgcat::_gettext('daytime') =~ /^(daytime)?$/
- ? 'Day Phone'
- : FS::Msgcat::_gettext('daytime');
-my $night_label = FS::Msgcat::_gettext('night') =~/^(night)?$/
- ? 'Night Phone'
- : FS::Msgcat::_gettext('night') || 'Night Phone';
-my $mobile_label = FS::Msgcat::_gettext('mobile') =~/^(mobile)?$/
- ? 'Mobile Phone'
- : FS::Msgcat::_gettext('mobile') || 'Mobile Phone';
+$opt{censustract} ||= $cust_main->censustract;
my $stateid_label = FS::Msgcat::_gettext('stateid') =~ /^(stateid)?$/
? 'Driver’s License'
? 'Driver’s License State'
: FS::Msgcat::_gettext('stateid_state') || 'Driver’s License State';
-my $r = qq!<font color="#ff0000">*</font> !;
-
my @invoicing_list = $cust_main->invoicing_list;
+my $agentnum = $cust_main->agentnum if $cust_main->custnum;
+
</%init>