X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;ds=sidebyside;f=httemplate%2Fedit%2Fcust_main%2Fbilling.html;h=5a66f0a60ddbedecca002152f9de127aa35dd2de;hb=708cd9ef94ccb96955c6b9fe9d2ccdc0b311b556;hp=17b1b0cc91fd12b1fcc03c7ad8d878c0e9b3e8fa;hpb=673b9a458d9138523026963df6fa3b4683e09bae;p=freeside.git
diff --git a/httemplate/edit/cust_main/billing.html b/httemplate/edit/cust_main/billing.html
index 17b1b0cc9..5a66f0a60 100644
--- a/httemplate/edit/cust_main/billing.html
+++ b/httemplate/edit/cust_main/billing.html
@@ -1,66 +1,44 @@
-<%
+%if ( $payby_default eq 'HIDE' ) {
+% $cust_main->payby('BILL') unless $cust_main->payby;
+% my $payby = $cust_main->payby;
-my( $cust_main ) = @_;
-my $conf = new FS::Conf;
-my $payby_default = $conf->config('payby-default');
-
-if ( $payby_default eq 'HIDE' ) {
-
- $cust_main->payby('BILL') unless $cust_main->payby;
-
-%>
-
-
-
-
-
-
+% foreach my $field (qw( payname paycvv paystart_month paystart_year payissue payip paytype paystate billday )) {
-
+
+
-<% } else {
+
- my @invoicing_list = $cust_main->invoicing_list;
+
- my $r = qq!* !;
+% } else {
+%
+% my $r = qq!* !;
-%>
-
-
Billing information
- <%= &ntable("#cccccc") %>
+
<% mt('Billing information') |h %>
+ <% &ntable("#cccccc") %>
- <%=$r%>Billing type |
+ <%$r%><% mt('Billing type') |h %> |
-
-
-
-
-
-
- <%
-
- my($payby, $payinfo, $payname)=(
- $cust_main->payby,
- $cust_main->payinfo,
- $cust_main->payname,
- );
- my( $account, $aba ) = split('@', $payinfo);
-
- 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 %payby = (
-
- 'CARD' =>
-
- '',
-
- 'CHEK' =>
-
- '',
-
- 'LECB' =>
-
- '',
+ function payauto_changed(payauto_field){
+ 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;
+ }
+ }
- 'BILL' =>
+ function tax_changed(what) {
+ var num = document.getElementById(what.id + '_num');
+ if ( what.checked ) {
+ num.disabled = false;
+ } else {
+ num.disabled = true;
+ }
+ }
+
+
- ''.
+ <& /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"';
+%
+% 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';
+%
+% #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 = (
+%
+% '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();',
+ &>
+
+ <% &ntable("#cccccc") %>
- qq!
P.O. | !.
- qq! |
!.
+ |
- qq!!.
- qq!!.
+% 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')
+% || ! $curuser->access_right('Edit customer tax exemptions')
+% )
+% {
- qq!Attention | !.
- qq! |
!.
+
- ' |
'.
- ' |
'.
- ' |
'.
- ' |
'.
- ' |
'.
+% } else {
- '',
+
+ tax eq "Y" ? 'CHECKED' : '' %>> Tax Exempt<% @exempt_groups ? ' (all taxes)' : '' %> |
+
- 'COMP' =>
+% }
- '',
+
+
- );
+
+ 'Credit card',
- 'CHEK' => 'Electronic check',
- 'LECB' => 'Phone bill billing',
- 'BILL' => 'Billing',
- 'COMP' => 'Complimentary',
- ;
- my %payby2option = (
- ( map { $_ => $_ } keys %options ),
- 'DCRD' => 'CARD',
- 'DCHK' => 'CHEK',
- );
+ ( grep { $_ eq 'FAX' } @invoicing_list )
+ ? 'CHECKED'
+ : ''
- my $widget = new HTML::Widgets::SelectLayers(
- 'options' => \%options,
- #'form_name' => 'dummy',
- #'form_action' => 'nothingyet',
- #chops bottom of page in IE# 'under_position' => 'absolute',
- 'html_between' => ' |
',
- 'selected_layer' => $payby2option{$payby} || 'CARD',
- 'layer_callback' => sub { my $layer = shift; $payby{$layer}; },
- );
+ %>> <% mt('Fax invoices') |h %>
- %>
+
+
- <%= $widget->html %>
+% }
-
+ <% $r %><% mt('required fields') |h %>
+% }
+
+
+
+<%once>
+
+my $paystate_label = FS::Msgcat::_gettext('paystate');
+$paystate_label = 'Bank state' if $paystate_label =~/^paystate$/;
+
+%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;
- <%= $r %> required fields
+my $show_term = '';
+if ( $cust_main->custnum ) {
+ #false laziness w/view/cust_main/billing.html
+ my $term_sql = "SELECT COUNT(*) FROM cust_pkg LEFT JOIN part_pkg USING ( pkgpart ) WHERE custnum = ? AND plan = 'cdr_termination' LIMIT 1";
+ my $term_sth = dbh->prepare($term_sql) or die dbh->errstr;
+ $term_sth->execute($cust_main->custnum) or die $term_sth->errstr;
+ $show_term = $term_sth->fetchrow_arrayref->[0];
+}
-<% } %>
+my $agentnum = $cust_main->agentnum if $cust_main->custnum;
+%init>
|