& /elements/header.html, mt("Process [_1] payment",$type{$payby}) &> <& /elements/small_custview.html, $cust_main, '', '', popurl(2) . "view/cust_main.cgi" &>
<& /elements/footer.html &> <%init> die "access denied" unless $FS::CurrentUser::CurrentUser->access_right('Process payment'); my %type = ( 'CARD' => 'credit card', 'CHEK' => 'electronic check (ACH)', ); $cgi->param('payby') =~ /^(CARD|CHEK)$/ or die "unknown payby ". $cgi->param('payby'); my $payby = $1; $cgi->param('custnum') =~ /^(\d+)$/ or die "illegal custnum ". $cgi->param('custnum'); my $custnum = $1; my $cust_main = qsearchs( 'cust_main', { 'custnum'=>$custnum } ); die "unknown custnum $custnum" unless $cust_main; my $location = $cust_main->bill_location; # no proper error handling on this anyway, but when we have it, # remember to repopulate fields in $location my $balance = $cust_main->balance; my $payinfo = ''; my $conf = new FS::Conf; my $auto = ( ( $payby eq 'CARD' && $cust_main->payby ne 'DCRD' ) || ( $payby eq 'CHEK' && $cust_main->payby eq 'CHEK' ) ) ? 1 : 0; my $disable_payauto_default = $conf->exists('disable_payauto_default'); my $possibly_uncheck_auto = ' ONCHANGE="possibly_uncheck_auto()"'; #false laziness w/selfservice make_payment.html shortcut for one-country my %states = map { $_->state => 1 } qsearch('cust_main_county', { 'country' => $conf->config('countrydefault') || 'US' } ); my @states = sort { $a cmp $b } keys %states; my $amount = ''; if ( $balance > 0 ) { # when configured to do so, amount will only auto-fill with balance # if balance represents a single invoice $amount = $balance unless $conf->exists('manual_process-single_invoice_amount') && ($cust_main->open_cust_bill != 1); } my $payunique = "webui-payment-". time. "-$$-". rand() * 2**32; %init>