% unless ( $opt{'js_only'} ) { % ### % # select % ### % ### % # card info % ### % my $card_display = $sel_payby eq 'CARD' ? '' : 'STYLE="display:none"'; % ### % # chek info % ### % my $chek_display = $sel_payby eq 'CHEK' ? '' : 'STYLE="display:none"'; % my ( $account, $aba, $branch ) = ( '', '', '' ); % if ( $cgi->param($name.'_payby') =~ /^(CHEK|DCHK)$/ ) { % $account = $cgi->param($name.'_payinfo1'); % $aba = $cgi->param($name.'_payinfo2'); % $branch = $cgi->param($name.'_payinfo3'); % } elsif ( $cust_payby->payby =~ /^(CHEK|DCHK)$/ ) { % ( $account, $aba ) = split('@', $cust_payby->payinfo); % ( $branch, $aba ) = split('\.',$aba) % if $echeck_country eq 'CA'; % } % % #false laziness w/view/cust_main/billing.html and misc/payment.cgi % my $routing_label = $echeck_country eq 'US' ? 'ABA/Routing #' % : 'Routing #'; % my $routing_size = $echeck_country eq 'CA' ? 4 : 10; % my $routing_maxlength = $echeck_country eq 'CA' ? 3 : 9; % my $bankname_size = $echeck_country eq 'CA' ? 13 : 20; % if ( $echeck_country eq 'CA' ) { % } % if ( $conf->exists('show_bankstate') ) { % } % ### % # auto (maybe this should be first...) % ### % #some fun javascript to enforce a single value for each weight

<% mt('Type') |h %>
>
<% mt('Card number') |h %>
> <& /elements/select-month_year.html, 'prefix' => $name. '_paydate', 'selected_date' => ( ( $cgi->param($name.'_payby') || $cust_payby->payby ) =~ /^(CARD|DCRD)$/ ? ( $cgi->param($name.'_paydate_month') ? $cgi->param($name.'_paydate_month'). '-1-'. $cgi->param($name.'_paydate_year') : $cust_payby->paydate ) : '' ), 'onhhange' => $onchange, &>
Expiration date
>
<% mt('CVV2') |h %> <& /elements/popup_link.html, 'action' => $p.'docs/cvv2.html', 'label' => mt('(help)'), 'actionlabel' => 'CVV2 Help', 'width' => 480, 'height' => 275, 'nocenter' => 1, #popup_name => 'cvv2_popup', &>
>
<% mt('Exact name on card') |h %>
>
<% mt('Account type') |h %>
>
<% mt('Account #') |h %> (<% mt('help') |h %>)
>
<% mt($routing_label) |h %>
>
<% mt('Branch #') |h %>
>
<% mt('Bank name') |h %>
> <& /elements/select-state.html, 'prefix' => $name. '_pay', 'empty' => emt('(choose)'), 'state' => ( scalar($cgi->param($name.'_paystate')) || $cust_payby->paystate ), #was cust_main->country in 3.x, but this will do until/unlesss # someone needs to track foreign bank states 'country' => ( scalar($conf->config('countrydefault')) || 'US' ), &>
<% mt('Bank state') |h %>

<% mt('Auto-charge') |h %>
% } % unless ( $opt{'html_only'} || $payby_changed_init ) { % $payby_changed_init = 1; % } <%once> my $payby_changed_init = 0; <%init> my( %opt ) = @_; my $conf = new FS::Conf; my $echeck_country = $conf->config('echeck-country'); my $name = $opt{'element_name'} || $opt{'field'} || 'custpaybynum'; my $id = $opt{'id'} || 'custpaybynum'; my $curr_value = $opt{'curr_value'} || $opt{'value'}; my $onchange = ''; if ( $opt{'onchange'} ) { $onchange = $opt{'onchange'}; $onchange .= '(this)' unless $onchange =~ /\(\w*\);?$/; $onchange =~ s/\(what\);/\(this\);/g; #ugh, terrible hack. all onchange #callbacks should act the same #$onchange = 'onChange="'. $onchange. '"'; } my $cust_payby; if ( $curr_value ) { $cust_payby = qsearchs('cust_payby', { 'custpaybynum' => $curr_value } ); } else { $cust_payby = new FS::cust_payby {}; } my $sel_payby = $cgi->param($name.'_payby') || $cust_payby->payby; # convert DCRD to CARD + no weight, and the same for DCHK/CHEK if ($sel_payby eq 'DCRD') { $sel_payby = 'CARD'; $cust_payby->weight(''); } elsif ($sel_payby eq 'DCHK') { $sel_payby = 'CHEK'; $cust_payby->weight(''); } elsif (!$sel_payby) { # default $sel_payby = 'CARD'; } my @payby = FS::payby->cust_payby; my %conf_payby = map { $_=>1 } $conf->config('payby'); @payby = grep $conf_payby{$_}, @payby if keys %conf_payby; @payby = grep $_ !~ /^(DCRD|DCHK)$/, @payby; my %weight = ( 1 => 'Primary', 2 => 'Secondary', 3 => 'Tertiary', 4 => 'Fourth', 5 => 'Fifth', 6 => 'Sixth', 7 => 'Seventh', );