<INPUT TYPE="hidden" NAME="<%$payby%>_payinfo" VALUE="<% $cust_main->paymask %>">
-% foreach my $field (qw( payname paycvv paystart_month paystart_year payissue payip paytype paystate )) {
+% foreach my $field (qw( payname paycvv paystart_month paystart_year payissue payip paytype paystate billday )) {
<INPUT TYPE="hidden" NAME="<% $payby.'_'.$field %>" VALUE="<% $cust_main->get($field) %>">
%
% my $r = qq!<font color="#ff0000">*</font> !;
- <BR><FONT SIZE="+1"><B><% mt('Billing information') |h %></B></FONT>
+ <BR><FONT CLASS="fsinnerbox-title"><% mt('Billing information') |h %></FONT>
<% &ntable("#cccccc") %>
<TR>
}
function payauto_changed(payauto_field){
- var f = (payauto_field.name == 'CARD_payauto') ? 'card_billday' : 'chek_billday';
- f = document.getElementById(f);
- if ( f == null) return;
- if(payauto_field.checked) f.style.display = 'inline';
- else f.style.display = 'none';
+ var select = (payauto_field.name == 'CARD_payauto') ? 'CARD_billday' : 'CHEK_billday';
+ var span = document.getElementById('td_'+select);
+ select = document.getElementById(select);
+ if (span == null || select == null) return;
+ if(payauto_field.checked) {
+ span.style.color = '#000000';
+ select.disabled = false;
+ }
+ else {
+ span.style.color = '#999999';
+ select.disabled = true;
+ //why? select.selectedIndex = 0;
+ }
}
+ function tax_changed(what) {
+ var num = document.getElementById(what.id + '_num');
+ if ( what.checked ) {
+ num.disabled = false;
+ } else {
+ num.disabled = true;
+ }
+ }
+
</SCRIPT>
<& /elements/init_overlib.html &>
% my $payby = $cust_main->payby;
% my $paytype = $cust_main->paytype;
% my( $account, $aba ) = split('@', $payinfo);
+% my $branch = '';
+% ($branch,$aba) = split('\.',$aba)
+% if $conf->config('echeck-country') eq 'CA';
%
% my $disabled = 'DISABLED style="background-color: #dddddd"';
% my $text_disabled = 'style="color: #999999"';
% }
% $ret;
% }
-% my $billday_card_display = $payby eq 'CARD' ? 'inline' : 'none';
-% my $billday_chek_display = $payby eq 'CHEK' ? 'inline' : 'none';
+%
+% my $card_billday_style = $payby eq 'CARD' ? '' : 'style="color: #999999"';
+% my $chek_billday_style = $payby eq 'CHEK' ? '' : 'style="color: #999999"';
+% my $card_billday_select_disabled = $payby eq 'CARD' ? '' : 'DISABLED';
+% my $chek_billday_select_disabled = $payby eq 'CHEK' ? '' : 'DISABLED';
+%
+% #false laziness w/view/cust_main/billing.html and misc/payment.cgi
+% my $routing_label = $conf->config('echeck-country') eq 'US'
+% ? 'ABA/Routing number'
+% : 'Routing number';
+% my $routing_size = $conf->config('echeck-country') eq 'CA' ? 4 : 10;
+% my $routing_maxlength = $conf->config('echeck-country') eq 'CA' ? 3 : 9;
+%
%
% my %payby = (
%
% qq!<TR><TD ALIGN="right" WIDTH="200">${r}!.emt('Exact name on card').qq! </TD>!.
% qq!<TD WIDTH="408"><INPUT TYPE="text" NAME="CARD_payname" VALUE="!. ( $payby =~ /^(CARD|DCRD)$/ ? $cust_main->payname : '' ). qq!"></TD></TR>!.
%
-% qq!<TR><TD COLSPAN=2 WIDTH="608"><INPUT TYPE="checkbox" onchange="payauto_changed(this);" ID="CARD_payauto" NAME="CARD_payauto" $CARD_payauto_checked> !.emt('Charge future payments to this [_1] automatically','credit card').qq!</TD></TR>!.
+% qq!<TR><TD COLSPAN=2 WIDTH="608">!.
+% qq!<INPUT TYPE="checkbox" onchange="payauto_changed(this);" ID="CARD_payauto" NAME="CARD_payauto" $CARD_payauto_checked> !.
+% emt('Charge future payments to this [_1] automatically','credit card').'</TD></TR>'.
%
% ( $conf->exists('cust_main-select-billday') ?
-% qq!<TR><TD COLSPAN="2" id="card_billday" style="display: $billday_card_display">
-% Charge on this day of each month <SELECT NAME="billday">!
+% qq!<TR><TD ALIGN="RIGHT" id="td_CARD_billday" $card_billday_style>
+% Charge on this day of each month</TD><TD>
+% <SELECT id="CARD_billday" $card_billday_select_disabled NAME="CARD_billday">!
% . billday_options($cust_main->billday) . qq!</SELECT> </TD></TR>!
% : ''
% ).
% join('', map { qq!<OPTION VALUE="$_" !.($paytype eq $_ ? 'SELECTED' : '').">$_</OPTION>" } @FS::cust_main::paytypes).
% qq!</SELECT></TD></TR>!.
%
-% qq!<TR><TD ALIGN="right" WIDTH="200">${r}!.emt('ABA/Routing number').qq! </TD>!.
-% qq!<TD COLSPAN="3" WIDTH="408"><INPUT TYPE="text" SIZE=10 MAXLENGTH=9 NAME="CHEK_payinfo2" VALUE="!. ( $payby =~ /^(CHEK|DCHK)$/ ? $aba : '' ). qq!" SIZE=10 MAXLENGTH=9> !.
+% qq!<TR><TD ALIGN="right" WIDTH="200">${r}!.emt($routing_label).qq! </TD>!.
+% qq!<TD COLSPAN="3" WIDTH="408"><INPUT TYPE="text" SIZE=$routing_size MAXLENGTH=$routing_maxlength NAME="CHEK_payinfo2" VALUE="!. ( $payby =~ /^(CHEK|DCHK)$/ ? $aba : '' ). qq!"> !.
% qq!(<A HREF="javascript:void(0);" onClick="overlib( OLiframeContent('../docs/ach.html', 380, 240, 'ach_popup' ), CAPTION, 'ACH Help', STICKY, AUTOSTATUSCAP, CLOSECLICK, DRAGGABLE ); return false;">!.emt('help').qq!</A>)!.
% qq!</TD></TR>!.
%
% qq!<INPUT TYPE="hidden" NAME="CHEK_exp_month" VALUE="12">!.
% qq!<INPUT TYPE="hidden" NAME="CHEK_exp_year" VALUE="2037">!.
%
+% ( $conf->config('echeck-country') eq 'CA' ?
+% qq!<TR><TD ALIGN="right">$r !.emt('Branch number').qq!</TD><TD COLSPAN="3">
+% <INPUT TYPE="text" name="CHEK_payinfo3" VALUE="$branch" SIZE=6 MAXLENGTH=5></TD></TR>! : '' ).
+%
% qq!<TR><TD ALIGN="right" WIDTH="200">${r}!.emt('Bank name').qq! </TD>!.
% qq!<TD COLSPAN="3" WIDTH="408"><INPUT TYPE="text" NAME="CHEK_payname" VALUE="!. ( $payby =~ /^(CHEK|DCHK)$/ ? $cust_main->payname : '' ). qq!"></TD></TR>!.
% ( $conf->exists('show_bankstate') ?
% ).
%
%
-% qq!<TR><TD COLSPAN=4 WIDTH="608"><INPUT TYPE="checkbox" onchange="payauto_changed(this);" ID="CHEK_payauto" NAME="CHEK_payauto" $CHEK_payauto_checked> !.emt('Charge future payments to this [_1] automatically','electronic check').qq!</TD></TR>!.
+% qq!<TR><TD COLSPAN=4 WIDTH="608">!.
+% qq!<INPUT TYPE="checkbox" onchange="payauto_changed(this);" ID="CHEK_payauto" NAME="CHEK_payauto" $CHEK_payauto_checked> !.
+% emt('Charge future payments to this [_1] automatically','electronic check').'</TD></TR>'.
%
% ( $conf->exists('cust_main-select-billday') ?
-% qq!<TR><TD COLSPAN="4" id="chek_billday" style="display: $billday_chek_display">
-% Charge on this day of each month <SELECT NAME="billday">!
+% qq!<TR><TD ALIGN="RIGHT" id="td_CHEK_billday" $chek_billday_style>
+% Charge on this day of each month</TD><TD>
+% <SELECT id="CHEK_billday" $chek_billday_select_disabled NAME="CHEK_billday">!
% . billday_options($cust_main->billday) . qq!</SELECT> </TD></TR>!
% : ''
% ).
<TR><TD> </TD></TR>
+% my $curuser = $FS::CurrentUser::CurrentUser;
% my @exempt_groups = grep /\S/, $conf->config('tax-cust_exempt-groups');
+% if ( $conf->exists('cust_class-tax_exempt')
+% || $conf->exists('tax-cust_exempt-groups-require_individual_nums')
+% || $conf->config('tax-cust_exempt-groups-num_req') =~ /\w/
+% || ! $curuser->access_right('Edit customer tax exemptions')
+% )
+% {
- <TR>
- <TD WIDTH="608" COLSPAN="2"><INPUT TYPE="checkbox" NAME="tax" VALUE="Y" <% $cust_main->tax eq "Y" ? 'CHECKED' : '' %>> Tax Exempt<% @exempt_groups ? ' (all taxes)' : '' %></TD>
- </TR>
+ <INPUT TYPE="hidden" NAME="tax" VALUE="<% $cust_main->tax eq 'Y' ? 'Y' : '' %>">
+
+% } else {
-% foreach my $exempt_group ( @exempt_groups ) {
-% #escape $exempt_group for NAME
<TR>
- <TD WIDTH="608" COLSPAN="2"> <INPUT TYPE="checkbox" NAME="tax_<% $exempt_group %>" VALUE="Y" <% $cust_main->tax_exemption($exempt_group) ? 'CHECKED' : '' %>> Tax Exempt (<% $exempt_group %> taxes)<TD>
+ <TD WIDTH="608" COLSPAN="2"><INPUT TYPE="checkbox" NAME="tax" VALUE="Y" <% $cust_main->tax eq "Y" ? 'CHECKED' : '' %>> Tax Exempt<% @exempt_groups ? ' (all taxes)' : '' %></TD>
</TR>
+
+% }
+
+% if ( $curuser->access_right('Edit customer tax exemptions') ) {
+% foreach my $exempt_group ( @exempt_groups ) {
+% my $cust_main_exemption = $cust_main->tax_exemption($exempt_group);
+% #escape $exempt_group for NAME etc.
+% my $checked = ($cust_main_exemption || $cgi->param("tax_$exempt_group"));
+ <TR>
+ <TD> <INPUT TYPE="checkbox" NAME="tax_<% $exempt_group %>" ID="tax_<% $exempt_group %>" VALUE="Y" <% $checked ? 'CHECKED' : '' %> onChange="tax_changed(this)"> Tax Exempt (<% $exempt_group %> taxes)</TD>
+ <TD> - Exemption number <INPUT TYPE="text" NAME="tax_<% $exempt_group %>_num" ID="tax_<% $exempt_group %>_num" VALUE="<% $cgi->param("tax_$exempt_group".'_num') || ( $cust_main_exemption ? $cust_main_exemption->exempt_number : '' ) |h %>" <% $checked ? '' : 'DISABLED' %>></TD>
+ </TR>
+% }
% }
% unless ( $conf->exists('emailinvoiceonly') ) {
? 'CHECKED'
: ''
- %>> <% mt('Postal mail invoice') |h %>
+ %>> <% mt('Postal mail invoices') |h %>
</TD>
</TR>
? 'CHECKED'
: ''
- %>> <% mt('Fax invoice') |h %>
+ %>> <% mt('Fax invoices') |h %>
</TD>
</TR>
% }
-% unless ( $conf->exists('cust-email-high-visibility')) {
<TR>
+ <TD WIDTH="608" COLSPAN="2"><INPUT TYPE="checkbox" NAME="invoice_email" VALUE="Y" <%
+
+ ( $cust_main->invoice_noemail eq 'Y' )
+ ? ''
+ : 'CHECKED'
+
+ %>> <% mt('Email invoices') |h %>
+
+ </TD>
+ </TR>
+
+% unless ( $conf->exists('cust-email-high-visibility')) {
+ <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 WIDTH="408"><INPUT TYPE="text" NAME="invoicing_list" VALUE="<% join(', ', grep { $_ !~ /^(POST|FAX)$/ } @invoicing_list ) %>">
+ <INPUT TYPE="checkbox" NAME="message_noemail" VALUE="Y" <%
+ ( $cust_main->message_noemail eq 'Y' )
+ ? 'CHECKED'
+ : ''
+ %>> <% emt('Do not send notices') %>
</TD>
- <TD WIDTH="408"><INPUT TYPE="text" NAME="invoicing_list" VALUE="<% join(', ', grep { $_ !~ /^(POST|FAX)$/ } @invoicing_list ) %>"></TD>
</TR>
% }
+% if ( $conf->exists('cust_main-select-prorate_day') ) {
+ <TR>
+ <TD ALIGN="right" WIDTH="200"><% mt('Prorate day (1-28)') |h %> </TD>
+ <TD>
+ <INPUT TYPE="text" NAME="prorate_day" VALUE="<% $cust_main->prorate_day %>" SIZE=3 MAXLENGTH=2>
+ </TD>
+ </TR>
+% } else {
+ <INPUT TYPE="hidden" NAME="prorate_day" VALUE="<% $cust_main->prorate_day %>">
+% }
+
<TR>
<TD ALIGN="right" WIDTH="200"><% mt('Invoice terms') |h %> </TD>
<TD WIDTH="408">
<& /elements/select-terms.html,
- 'curr_value' => $cust_main->invoice_terms,
+ 'curr_value' => $cust_main->invoice_terms,
+ 'agentnum' => $cust_main->agentnum,
&>
</TD>
</TR>
obj.form.credit_limit.disabled = obj.checked;
}
</SCRIPT>
- <INPUT TYPE="text" NAME="credit_limit" VALUE=<% sprintf('"%.2f"', $cust_main->credit_limit) %><% length($cust_main->credit_limit) ? '' : ' DISABLED' %>>
- <INPUT TYPE="checkbox" NAME="no_credit_limit" VALUE=1 onclick="toggle(this)"<% length($cust_main->credit_limit) ? '' : ' CHECKED'%>> <% mt('Unlimited') |h %>
+ <INPUT TYPE = "text"
+ NAME = "credit_limit"
+ VALUE = "<% sprintf('%.2f', $cust_main->credit_limit) %>"
+ <% length($cust_main->credit_limit) ? '' : ' DISABLED' %>
+ >
+% my $default_credit_limit = $conf->config('default_credit_limit');
+ <INPUT TYPE = "checkbox"
+ NAME = "no_credit_limit"
+ VALUE = 1
+ onClick="toggle(this)"
+ <% length($cust_main->credit_limit) ? '' : ' CHECKED'%>
+ > <% $default_credit_limit
+ ? "Default ($money_char". sprintf("%.2f", $default_credit_limit).
+ ")"
+ : mt('Unlimited')
+ |h
+ %>
</TD>
</TR>
% if ( $conf->exists('voip-cust_cdr_squelch') ) {
<TR>
- <TD COLSPAN="2"><INPUT TYPE="checkbox" NAME="squelch_cdr" VALUE="Y" <% $cust_main->squelch_cdr eq "Y" ? 'CHECKED' : '' %>> <% mt('Omit CDRs from printed invoices') |h %></TD>
+ <TD COLSPAN="2"><INPUT TYPE="checkbox" NAME="squelch_cdr" VALUE="Y" <% $cust_main->squelch_cdr eq "Y" ? 'CHECKED' : '' %>> <% mt($conf->exists('voip-cdr_email') ? 'Omit CDRs from printed invoices' : 'Omit CDRs from invoices') |h %></TD>
</TR>
% } else {
<INPUT TYPE="hidden" NAME="squelch_cdr" VALUE="<% $cust_main->squelch_cdr %>">
<INPUT TYPE="hidden" NAME="cdr_termination_percentage" VALUE="<% $cust_main->cdr_termination_percentage %>">
% }
+%my @available_locales = $conf->config('available-locales');
+%if ( scalar(@available_locales) ) {
+% push @available_locales, ''
+% unless $cust_main->locale && $conf->exists('cust_main-require_locale');
+% my %locale_labels = map {
+% my %ll;
+% my %info = FS::Locales->locale_info($_);
+% $ll{$_} = $info{name} . " (" . $info{country} . ")";
+% %ll;
+% } FS::Locales->locales;
+%
+% my $label = ( $conf->exists('cust_main-require_locale') ? $r : '' ).
+% emt('Invoicing locale');
+
+ <& /elements/tr-select.html,
+ 'label' => $label,
+ 'field' => 'locale',
+ 'options' => \@available_locales,
+ 'labels' => \%locale_labels,
+ 'curr_value' => $cust_main->locale,
+ &>
+% }
+
</TABLE>
- <% $r %> <% mt('required fields') |h %>
+ <% $r %><% mt('required fields') |h %>
% }
+<script type="text/javascript">
+ init_payauto_changed();
+</script>
+
<%once>
my $paystate_label = FS::Msgcat::_gettext('paystate');
my $conf = new FS::Conf;
my $payby_default = $conf->config('payby-default');
+my $money_char = $conf->config('money_char') || '$';
+
my @payby = grep /\w/, $conf->config('payby');
#@payby = (qw( CARD DCRD CHEK DCHK LECB BILL CASH WEST COMP ))
@payby = (qw( CARD DCRD CHEK DCHK LECB BILL CASH COMP ))
$show_term = $term_sth->fetchrow_arrayref->[0];
}
+my $agentnum = $cust_main->agentnum if $cust_main->custnum;
+
</%init>