<% include("/elements/header.html", $title, '') %>
% }
-% if ( $cgi->param('error') ) {
- <FONT SIZE="+1" COLOR="#ff0000">Error: <% $cgi->param('error') %></FONT>
- <BR><BR>
-% }
-
-<LINK REL="stylesheet" TYPE="text/css" HREF="../elements/calendar-win2k-2.css" TITLE="win2k-2">
-<SCRIPT TYPE="text/javascript" SRC="../elements/calendar_stripped.js"></SCRIPT>
-<SCRIPT TYPE="text/javascript" SRC="../elements/calendar-en.js"></SCRIPT>
-<SCRIPT TYPE="text/javascript" SRC="../elements/calendar-setup.js"></SCRIPT>
+<% include('/elements/init_calendar.html') %>
-<FORM ACTION="<% popurl(1) %>process/cust_pay.cgi" METHOD=POST>
-<INPUT TYPE="hidden" NAME="link" VALUE="<% $link %>">
-<INPUT TYPE="hidden" NAME="linknum" VALUE="<% $linknum %>">
+<% include('/elements/error.html') %>
% unless ( $link eq 'popup' ) {
<% small_custview($custnum, $conf->config('countrydefault')) %>
% }
+<FORM NAME="PaymentForm" ACTION="<% popurl(1) %>process/cust_pay.cgi" METHOD=POST onSubmit="document.PaymentForm.submit.disabled=true">
+<INPUT TYPE="hidden" NAME="link" VALUE="<% $link %>">
+<INPUT TYPE="hidden" NAME="linknum" VALUE="<% $linknum %>">
<INPUT TYPE="hidden" NAME="payby" VALUE="<% $payby %>">
+<INPUT TYPE="hidden" NAME="paybatch" VALUE="<% $paybatch %>">
<BR><BR>
+
Payment
<% ntable("#cccccc", 2) %>
<TR>
<TD ALIGN="right">Amount</TD>
<TD BGCOLOR="#ffffff" ALIGN="right"><% $money_char %></TD>
- <TD><INPUT TYPE="text" NAME="paid" VALUE="<% $paid %>" SIZE=8 MAXLENGTH=8> by <B><% $payby{$payby} %></B></TD>
+ <TD><INPUT TYPE="text" NAME="paid" VALUE="<% $paid %>" SIZE=8 MAXLENGTH=8> by <B><% FS::payby->payname($payby) %></B></TD>
</TR>
% if ( $payby eq 'BILL' ) {
% }
</TR>
-</TABLE>
+% if ( $conf->exists('pkg-balances') ) {
+ <% include('/elements/tr-select-cust_pkg-balances.html',
+ 'custnum' => $custnum,
+ 'cgi' => $cgi
+ )
+ %>
+% } else {
+ <INPUT TYPE="hidden" NAME="pkgnum" VALUE="">
+% }
-<INPUT TYPE="hidden" NAME="paybatch" VALUE="<% $paybatch %>">
+</TABLE>
<BR>
<INPUT TYPE="submit" VALUE="Post payment">
</FORM>
-</BODY>
-</HTML>
-<%once>
-my $conf = new FS::Conf;
+% if ( $link eq 'popup' ) {
+ </BODY>
+ </HTML>
+% } else {
+ <% include('/elements/footer.html') %>
+% }
-my %payby = (
- 'BILL' => 'Check',
- 'CASH' => 'Cash',
- 'WEST' => 'Western Union',
- 'MCRD' => 'Manual credit card',
-);
+<%init>
+
+my $conf = new FS::Conf;
my $money_char = $conf->config('money_char') || '$';
-</%once>
-<%init>
-my($link, $linknum, $paid, $payby, $payinfo, $_date);
+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');
my $paybatch = "webui-$_date-$$-". rand() * 2**32;
-my $title = 'Post '. $payby{$payby}. ' payment';
+my $title = 'Post '. FS::payby->payname($payby). ' payment';
$title .= " against Invoice #$linknum" if $link eq 'invnum';
my $custnum;
my $cust_bill = qsearchs('cust_bill', { 'invnum' => $linknum } )
or die "unknown invnum $linknum";
$custnum = $cust_bill->custnum;
-} elsif ( $link eq 'custnum' ) {
+} elsif ( $link eq 'custnum' || $link eq 'popup' ) {
$custnum = $linknum;
}
-</%init>
+</%init>