X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=httemplate%2Fedit%2Fcust_pay.cgi;h=3fd9c79eb1681e6430ef5a4aff2fbb0cbb09da49;hb=573139dbd6c37808697bfa72a3a468bb0980d4dd;hp=c0a679b03252c5079b5c7a9a4750ce1c4ea1f71d;hpb=a4c0576ff77b5932e337a48e56a6e02ff59964f5;p=freeside.git diff --git a/httemplate/edit/cust_pay.cgi b/httemplate/edit/cust_pay.cgi index c0a679b03..3fd9c79eb 100755 --- a/httemplate/edit/cust_pay.cgi +++ b/httemplate/edit/cust_pay.cgi @@ -1,126 +1,157 @@ - -<% +% if ( $link eq 'popup' ) { + <& /elements/header-popup.html, $title &> +% } else { + <& /elements/header.html, $title, '' &> +% } + +<& /elements/init_calendar.html &> + +<& /elements/error.html &> + +% unless ( $link eq 'popup' ) { + <% small_custview($custnum, $conf->config('countrydefault')) %> +% } + +
+ + + + + +

+ +<% mt('Payment') |h %> +<% ntable("#cccccc", 2) %> + + + <% mt('Date') |h %> + + + + + + + + + + <% mt('Amount') |h %> + <% $money_char %> + <% mt('by') |h %> <% mt(FS::payby->payname($payby)) |h %> + + + <& /elements/tr-select-discount_term.html, + 'custnum' => $custnum, + 'amount_id' => 'paid', + &> + +% if ( $payby eq 'BILL' ) { + + <% mt('Check #') |h %> + + +% } + + +% if ( $link eq 'custnum' || $link eq 'popup' ) { + + <% mt('Auto-apply to invoices') |h %> + + + + +% } elsif ( $link eq 'invnum' ) { + + <% mt('Apply to') |h %> + Invoice #<% $linknum %> only + + +% } + + +% if ( $conf->exists('pkg-balances') ) { + <& /elements/tr-select-cust_pkg-balances.html, + 'custnum' => $custnum, + 'cgi' => $cgi + &> +% } else { + +% } + + + +
+ + +
+ +% if ( $link eq 'popup' ) { + + +% } else { + <& /elements/footer.html &> +% } + +<%init> my $conf = new FS::Conf; -my($link, $linknum, $paid, $payby, $payinfo, $quickpay, $_date); +my $money_char = $conf->config('money_char') || '$'; +my $date_format = $conf->config('date_format') || '%m/%d/%Y'; + +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'); - $quickpay = $cgi->param('quickpay'); - $_date = $cgi->param('_date') ? str2time($cgi->param('_date')) : time; -} elsif ($cgi->keywords) { - my($query) = $cgi->keywords; - $query =~ /^(\d+)$/; - $link = 'invnum'; + $_date = $cgi->param('_date') ? parse_datetime($cgi->param('_date')) : time; +} elsif ( $cgi->param('custnum') =~ /^(\d+)$/ ) { + $link = $cgi->param('popup') ? 'popup' : 'custnum'; $linknum = $1; $paid = ''; - $payby = 'BILL'; - $payinfo = ""; - $quickpay = ''; + $payby = $cgi->param('payby') || 'BILL'; + $payinfo = ''; $_date = time; -} elsif ( $cgi->param('custnum') =~ /^(\d+)$/ ) { - $link = 'custnum'; +} elsif ( $cgi->param('invnum') =~ /^(\d+)$/ ) { + $link = 'invnum'; $linknum = $1; $paid = ''; - $payby = 'BILL'; - $payinfo = ''; - $quickpay = $cgi->param('quickpay'); + $payby = $cgi->param('payby') || 'BILL'; + $payinfo = ""; $_date = time; } else { die "illegal query ". $cgi->keywords; } -my $paybatch = "webui-$_date-$$-". rand() * 2**32; - -my $title = 'Post payment'; -$title .= " against Invoice #$linknum" if $link eq 'invnum'; +my @rights = ('Post payment'); +push @rights, 'Post check payment' if $payby eq 'BILL'; +push @rights, 'Post cash payment' if $payby eq 'CASH'; -%> +die "access denied" + unless $FS::CurrentUser::CurrentUser->access_right(\@rights); -<%= header($title, '') %> - -<% if ( $cgi->param('error') ) { %> -Error: <%= $cgi->param('error') %> -

-<% } %> - -<%= ntable("#cccccc",2) %> - - - - - +my $paybatch = "webui-$_date-$$-". rand() * 2**32; -
- - - +my $title = mt('Post '. FS::payby->payname($payby). ' payment'); +$title .= mt(" against Invoice #[_1]",$linknum) if $link eq 'invnum'; -<% -my $money_char = $conf->config('money_char') || '$'; 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' ) { +} elsif ( $link eq 'custnum' || $link eq 'popup' ) { $custnum = $linknum; } -%> - -<%= small_custview($custnum, $conf->config('countrydefault')) %> - - -

-Payment -<%= ntable("#cccccc", 2) %> - - Date - - "> - - - - - - Amount - <%= $money_char %> - - - - Check # - - - - -<% if ( $link eq 'custnum' ) { %> - Auto-apply
to invoices - -<% } elsif ( $link eq 'invnum' ) { %> - Apply to - Invoice #<%= $linknum %> only - -<% } %> - - - - - - -
- -
- - +