X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=httemplate%2Fedit%2Fcust_main%2Fbilling.html;h=fbe3e485c505e5f2451c17292d833f90eec8f865;hb=5d5ed9e94c8c9520f8d36ef23bbe47a135c35639;hp=3ac063509104eef1d0319b646e3132a9a6ed7faf;hpb=0607b801aac6e9b6e3fa6e463405ed5348feacc4;p=freeside.git
diff --git a/httemplate/edit/cust_main/billing.html b/httemplate/edit/cust_main/billing.html
index 3ac063509..fbe3e485c 100644
--- a/httemplate/edit/cust_main/billing.html
+++ b/httemplate/edit/cust_main/billing.html
@@ -1,504 +1,223 @@
-%if ( $payby_default eq 'HIDE' ) {
-% $cust_main->payby('BILL') unless $cust_main->payby;
-% my $payby = $cust_main->payby;
-
-
+% my $r = qq!* !;
-
+
-
+
<% mt('Billing information') |h %>
-% }
+
-% #false laziness w/elements/select-month_year.html & view/cust_main/billing.html
-% my( $mon, $year );
-% my $date = $cust_main->paydate || '12-2037';
-% if ( $date =~ /^(\d{4})-(\d{1,2})-\d{1,2}$/ ) { #PostgreSQL date format
-% ( $mon, $year ) = ( $2, $1 );
-% } elsif ( $date =~ /^(\d{1,2})-(\d{1,2}-)?(\d{4}$)/ ) {
-% ( $mon, $year ) = ( $1, $3 );
-% } else {
-% die "unrecognized expiration date format: $date";
-% }
+% my $curuser = $FS::CurrentUser::CurrentUser;
-
-
+% ###
+% # complimentry flag
+% ###
-
+% if ( $curuser->access_right('Complimentary customer') ) {
-
+ <& /elements/tr-checkbox.html,
+ field => 'complimentary',
+ label => emt('Complimentary customer'),
+ value => 'Y',
+ curr_value => $cust_main->complimentary,
+ box_first => 1,
+ &>
-% } else {
-%
-% my $r = qq!* !;
+% } else {
-
<% mt('Billing information') |h %>
- <% &ntable("#cccccc") %>
+
-
- <%$r%><% mt('Billing type') |h %> |
+% }
-
+% unless ( $conf->exists('emailinvoiceonly') ) {
- <& /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->exists('cust_main-require-bank-branch');
-%
-% my $disabled = 'DISABLED style="background-color: #dddddd"';
-% my $text_disabled = 'style="color: #999999"';
-%
-% if ( $payby =~ /^(CARD|DCRD)$/ && cardtype($payinfo) =~ /^(Switch|Solo)$/ ) {
-% $disabled = 'style="background-color: #ffffff"';
-% $text_disabled = 'style="color: #000000";'
-% }
-%
-% my $disable_payauto = $conf->exists('disable_payauto_default');
-% my $CARD_payauto_checked = $payby eq 'DCRD' ? ''
-% : $payby eq 'CARD' ? 'CHECKED'
-% : $disable_payauto ? '' : 'CHECKED';
-% my $CHEK_payauto_checked = $payby eq 'DCHK' ? ''
-% : $payby eq 'CHEK' ? 'CHECKED'
-% : $disable_payauto ? '' : 'CHECKED';
-%
-% sub billday_options {
-% my $curr_value = shift;
-% my $ret = '';
-% for my $billday ( 1 .. 28 ) {
-% my $sel = '';
-% $sel = "SELECTED='SELECTED'" if $curr_value == $billday;
-% $ret .= "";
-% }
-% $ret;
-% }
-%
-% 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';
-%
-% my %payby = (
-%
-% 'CARD' =>
-%
-% ''.
-%
-% qq!${r}!.emt('Card number').qq! | !.
-% qq! |
!.
-%
-% qq!${r}!.emt('Expiration').qq! | !.
-% ''.
-%
-% include('/elements/select-month_year.html',
-% 'prefix' => 'CARD_exp',
-% 'selected_date' =>
-% ( $payby =~ /^(CARD|DCRD)$/ ? $cust_main->paydate : '' ),
-% ).
-%
-% ' |
'.
-%
-% qq!!.emt('CVV2').qq! !.
-%
-% qq!(!.emt('help').qq!)!.
-% qq! | !.
-% ''.
-%
-% qq! |
!.emt('Start date').qq! | !.
-% ''.
-%
-% include('/elements/select-month_year.html',
-% 'prefix' => 'CARD_paystart',
-% 'disabled' => $disabled,
-% 'empty_option' => 1,
-% 'start_year' => 2000,
-% 'end_year' => (localtime())[5] + 1900,
-% 'selected_date' => (
-% ( $payby =~ /^(CARD|DCRD)$/
-% && cardtype($payinfo) =~ /^(Switch|Solo)$/ )
-% ? $cust_main->paystart_month. '-'.
-% $cust_main->paystart_year
-% : ''
-% )
-% ).
-%
-% qq!!.emt('or Issue number').qq! !.
-% ' |
!.
-%
-% qq!${r}!.emt('Exact name on card').qq! | !.
-% qq! |
!.
-%
-% qq!!.
-% qq! !.
-% emt('Charge future payments to this [_1] automatically','credit card').' |
'.
-%
-% ( $conf->exists('cust_main-select-billday') ?
-% qq!
-% Charge on this day of each month |
-% |
!
-% : ''
-% ).
-%
-% '
',
-%
-% 'CHEK' =>
-%
-% '',
-%
-% 'LECB' =>
-%
-% '',
-%
-% 'BILL' =>
-%
-% '',
-%
-% 'COMP' =>
-%
-% '',
-%
-% 'CASH' =>
-%
-% '',
-%
-% 'WEST' =>
-%
-% '',
-%
-% 'MCRD' =>
-%
-% '',
-%
-% );
-%
-% #this should use FS::payby
-% my @allopt = qw( CARD CHEK LECB BILL CASH WEST MCRD COMP );
-%
-% my %allopt = map { $_ => FS::payby->shortname($_) } @allopt;
-%
-% if ( $cust_main->custnum ) {
-% #don't offer CASH/WEST/MCRD initial payment types when editing customer
-% delete $allopt{$_} for qw(CASH WEST MCRD);
-% }
-%
-% my @options = grep exists( $allopt{$_} ), @payby;
-%
-% my %payby2option = (
-% ( map { $_ => $_ } @options ),
-% 'DCRD' => 'CARD',
-% 'DCHK' => 'CHEK',
-% );
-
-
- <& /elements/selectlayers.html,
- 'field' => 'payby',
- 'curr_value' => $payby2option{$payby || $payby_default || $payby[0] },
- 'options' => \@options,
- 'labels' => \%allopt,
- 'html_between' => ' |
',
- 'layer_callback' => sub { my $layer = shift; $payby{$layer}; },
- 'onchange' => 'init_payauto_changed();',
+ <& /elements/tr-checkbox.html,
+ field => 'postal_invoice',
+ label => emt('Postal mail invoices'),
+ value => 'Y',
+ curr_value => $cust_main->postal_invoice,
+ box_first => 1,
&>
- <% &ntable("#cccccc") %>
-
- |
+% }
-% my @exempt_groups = grep /\S/, $conf->config('tax-cust_exempt-groups');
+% ###
+% # email invoices
+% ###
-
- tax eq "Y" ? 'CHECKED' : '' %>> Tax Exempt<% @exempt_groups ? ' (all taxes)' : '' %> |
-
+ <& /elements/tr-checkbox.html,
+ field => 'invoice_noemail',
+ label => emt('Do not send email invoices'),
+ value => 'Y',
+ curr_value => $cust_main->invoice_noemail,
+ box_first => 1,
+ &>
-% foreach my $exempt_group ( @exempt_groups ) {
-% #escape $exempt_group for NAME
-
- tax_exemption($exempt_group) ? 'CHECKED' : '' %>> Tax Exempt (<% $exempt_group %> taxes) |
- |
-% }
+ <& /elements/tr-checkbox.html,
+ field => 'message_noemail',
+ label => emt('Do not send other email notices'),
+ value => 'Y',
+ curr_value => $cust_main->message_noemail,
+ box_first => 1,
+ &>
-% unless ( $conf->exists('emailinvoiceonly') ) {
+% ###
+% # prorate_day
+% ###
+% if ( $conf->exists('cust_main-select-prorate_day') ) {
- > <% mt('Postal mail invoice') |h %>
-
+ | <% mt('Prorate day') |h %>
+ |
+
|
-
-
+% }
- %>> <% mt('Fax invoice') |h %>
+% ###
+% # billday
+% ###
+ |
+ <% mt('Charge card/e-check on this day of the month') |h %>
+ |
+
|
-% }
+% sub billday_options {
+% my $curr_value = shift;
+% my $ret = '';
+% for my $billday ( 1 .. 28 ) {
+% my $sel = '';
+% $sel = "SELECTED='SELECTED'" if $curr_value == $billday;
+% $ret .= "";
+% }
+% $ret;
+% }
-% unless ( $conf->exists('cust-email-high-visibility')) {
-
-
- <% $conf->exists('cust_main-require_invoicing_list_email') ? $r : '' %>Email address(es)
- |
- |
-
-% }
+% ###
+% # invoice_terms
+% ###
- <% mt('Invoice terms') |h %> |
+ <% mt('Invoice terms') |h %>
|
<& /elements/select-terms.html,
- 'curr_value' => $cust_main->invoice_terms,
+ 'curr_value' => $cust_main->invoice_terms,
+ 'agentnum' => $cust_main->agentnum,
&>
|
+% ###
+% # credit_limit
+% ###
+
- <% mt('Credit limit') |h %> |
+ <% mt('Credit limit') |h %>
|
- credit_limit) %><% length($cust_main->credit_limit) ? '' : ' DISABLED' %>>
- credit_limit) ? '' : ' CHECKED'%>> <% mt('Unlimited') |h %>
+ credit_limit) ? '' : ' DISABLED' %>
+ >
+% my $default_credit_limit = $conf->config('default_credit_limit');
+ credit_limit) ? '' : ' CHECKED'%>
+ >
+ <% $default_credit_limit
+ ? "Default ($money_char". sprintf("%.2f", $default_credit_limit).
+ ")"
+ : mt('Unlimited')
+ |h
+ %>
+
|
+% ###
+% # CDR flags / options
+% ###
+
% if ( $conf->exists('voip-cust_cdr_spools') ) {
spool_cdr eq "Y" ? 'CHECKED' : '' %>> <% mt('Spool CDRs') |h %> |
@@ -509,7 +228,7 @@ function toggle(obj) {
% if ( $conf->exists('voip-cust_cdr_squelch') ) {
- squelch_cdr eq "Y" ? 'CHECKED' : '' %>> <% mt('Omit CDRs from printed invoices') |h %> |
+ squelch_cdr eq "Y" ? 'CHECKED' : '' %>> <% mt($conf->exists('voip-cdr_email') ? 'Omit CDRs from printed invoices' : 'Omit CDRs from invoices') |h %> |
% } else {
@@ -538,7 +257,7 @@ function toggle(obj) {
% if ( $show_term || $cust_main->cdr_termination_percentage ) {
- <% mt('CDR termination settlement') |h %> |
+ <% mt('CDR termination settlement') |h %>
|
% }
-
-
- <% $r %> <% mt('required fields') |h %>
-% }
+% ###
+% # Invoicing currency
+% ###
+
+%my @currencies = $conf->config('currencies');
+%if ( scalar(@currencies) ) {
+% unshift @currencies, ''; #default
+% my %currency_labels = map { $_ => "$_: ". code2currency($_) } @currencies;
+% $currency_labels{''} =
+% 'Default: '. code2currency( $conf->config('currency') || 'USD' );
+
+ <& /elements/tr-select.html,
+ 'label' => emt('Invoicing currency'),
+ 'field' => 'currency',
+ 'options' => \@currencies,
+ 'labels' => \%currency_labels,
+ 'curr_value' => $cust_main->currency,
+ &>
+% }
-
+% ###
+% # Invoicing locale
+% ###
+
+%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,
+ &>
+% }
-<%once>
+
+
-my $paystate_label = FS::Msgcat::_gettext('paystate');
-$paystate_label = 'Bank state' if $paystate_label =~/^paystate$/;
+ <% mt('Payment information') |h %>
+ <& cust_payby.html, 'cust_main'=>$cust_main, &>
-%once>
<%init>
my( $cust_main, %options ) = @_;
my @invoicing_list = @{ $options{'invoicing_list'} };
-my $payinfo = $options{'payinfo'};
my $conf = new FS::Conf;
-my $payby_default = $conf->config('payby-default');
-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 ))
- unless @payby;
+my $money_char = $conf->config('money_char') || '$';
my $show_term = '';
if ( $cust_main->custnum ) {
@@ -587,4 +339,6 @@ if ( $cust_main->custnum ) {
$show_term = $term_sth->fetchrow_arrayref->[0];
}
+my $agentnum = $cust_main->agentnum if $cust_main->custnum;
+
%init>
|