X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=httemplate%2Fedit%2Fcust_pay.cgi;h=cc4ec605dee2e596b5360a72a2d63c14b062a85b;hp=d1823d4b306ea5e72ad99e0dc4c8559f585b2e2f;hb=37591b61f8ad6fc5c5acb2fd8f520d2dbe4f1539;hpb=3d671921441ba8422650b54435a1959ad1d4c71d diff --git a/httemplate/edit/cust_pay.cgi b/httemplate/edit/cust_pay.cgi index d1823d4b3..cc4ec605d 100755 --- a/httemplate/edit/cust_pay.cgi +++ b/httemplate/edit/cust_pay.cgi @@ -1,69 +1,149 @@ -<% -# +% 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 ( $conf->exists('pkg-balances') ) { + <% include('/elements/tr-select-cust_pkg-balances.html', + 'custnum' => $custnum, + 'cgi' => $cgi + ) + %> +% } else { + +% } + + -use strict; -use vars qw( $cgi $invnum $p1 $_date $payby $payinfo $paid ); -use Date::Format; -use CGI; -use CGI::Carp qw(fatalsToBrowser); -use FS::UID qw(cgisuidsetup); -use FS::CGI qw(header popurl); - -$cgi = new CGI; -cgisuidsetup($cgi); - -if ( $cgi->param('error') ) { - $invnum = $cgi->param('invnum'); - $paid = $cgi->param('paid'); - $payby = $cgi->param('payby'); - $payinfo = $cgi->param('payinfo'); -} else { - my ($query) = $cgi->keywords; - $query =~ /^(\d+)$/; - $invnum = $1; - $paid = ''; - $payby = "BILL"; - $payinfo = ""; -} -$_date = time; - -$p1 = popurl(1); -print $cgi->header( '-expires' => 'now' ), header("Enter payment", ''); - -print qq!Error: !, $cgi->param('error'), - "" - if $cgi->param('error'); +
+ -print < -
-END
+
 
-print qq!Invoice #$invnum!;
+% if ( $link eq 'popup' ) { 
+    
+    
+% } else { 
+    <% include('/elements/footer.html') %>
+% } 
 
-print qq!
Date: !, time2str("%D",$_date), qq!!; +<%init> -print qq!
Amount \$!; +my $conf = new FS::Conf; -print qq!
Payby: $payby!; +my $money_char = $conf->config('money_char') || '$'; +my $date_format = $conf->config('date_format') || '%m/%d/%Y'; -#payinfo (check # now as payby="BILL" hardcoded.. what to do later?) -print qq!
Check #!; +die "access denied" + unless $FS::CurrentUser::CurrentUser->access_right('Post payment'); -#paybatch -print qq!!; +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') ? parse_datetime($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; +} -print < -
- -END +my $paybatch = "webui-$_date-$$-". rand() * 2**32; -print <payname($payby). ' payment'; +$title .= " against Invoice #$linknum" if $link eq 'invnum'; - - - -END +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' || $link eq 'popup' ) { + $custnum = $linknum; +} -%> +