% if ( $link eq 'popup' ) { <% include('/elements/header-popup.html', $title ) %> % } else { <% include("/elements/header.html", $title, '') %> % } <% include('/elements/init_calendar.html') %> <% include('/elements/error.html') %> % unless ( $link eq 'popup' ) { <% small_custview($custnum, $conf->config('countrydefault')) %> % }


Payment <% ntable("#cccccc", 2) %> Date "> Amount <% $money_char %> by <% FS::payby->payname($payby) %> % if ( $payby eq 'BILL' ) { Check # % } % if ( $link eq 'custnum' || $link eq 'popup' ) { Auto-apply
to invoices % } elsif ( $link eq 'invnum' ) { Apply to Invoice #<% $linknum %> only % }
% if ( $link eq 'popup' ) { % } else { <% include('/elements/footer.html') %> % } <%init> my $conf = new FS::Conf; my $money_char = $conf->config('money_char') || '$'; die "access denied" unless $FS::CurrentUser::CurrentUser->access_right('Post payment'); my($link, $linknum, $paid, $payby, $payinfo, $_date); if ( $cgi->param('error') ) { $link = $cgi->param('link'); $linknum = $cgi->param('linknum'); $paid = $cgi->param('paid'); $payby = $cgi->param('payby'); $payinfo = $cgi->param('payinfo'); $_date = $cgi->param('_date') ? str2time($cgi->param('_date')) : time; } elsif ( $cgi->param('custnum') =~ /^(\d+)$/ ) { $link = $cgi->param('popup') ? 'popup' : 'custnum'; $linknum = $1; $paid = ''; $payby = $cgi->param('payby') || 'BILL'; $payinfo = ''; $_date = time; } elsif ( $cgi->param('invnum') =~ /^(\d+)$/ ) { $link = 'invnum'; $linknum = $1; $paid = ''; $payby = $cgi->param('payby') || 'BILL'; $payinfo = ""; $_date = time; } else { die "illegal query ". $cgi->keywords; } my $paybatch = "webui-$_date-$$-". rand() * 2**32; my $title = 'Post '. FS::payby->payname($payby). ' payment'; $title .= " against Invoice #$linknum" if $link eq 'invnum'; my $custnum; if ( $link eq 'invnum' ) { my $cust_bill = qsearchs('cust_bill', { 'invnum' => $linknum } ) or die "unknown invnum $linknum"; $custnum = $cust_bill->custnum; } elsif ( $link eq 'custnum' ) { $custnum = $linknum; }