X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=httemplate%2Fedit%2Fprocess%2Fcust_pay.cgi;h=e74f9022f1ec2eba4caa62dafdd95ee9052074fc;hb=c5e31619e5a3071506cff19578e9e377753a96f4;hp=a310c5306ad7c362cefb49f5590b8b8964b293b0;hpb=87ddf7284561e5c912aefe2ecc3f348649b78183;p=freeside.git diff --git a/httemplate/edit/process/cust_pay.cgi b/httemplate/edit/process/cust_pay.cgi index a310c5306..e74f9022f 100755 --- a/httemplate/edit/process/cust_pay.cgi +++ b/httemplate/edit/process/cust_pay.cgi @@ -7,11 +7,12 @@ % if ( $cgi->param('apply') eq 'yes' ) { % my $cust_main = qsearchs('cust_main', { 'custnum' => $linknum }) % or die "unknown custnum $linknum"; -% $cust_main->apply_payments( 'manual' => 1 ); +% $cust_main->apply_payments( 'manual' => 1, +% 'backdate_application' => ($_date < time-86400) ); % } % if ( $link eq 'popup' ) { % -<% header('Payment entered') %> +<% header(emt('Payment entered')) %> @@ -27,9 +28,6 @@ %} <%init> -die "access denied" - unless $FS::CurrentUser::CurrentUser->access_right('Post payment'); - $cgi->param('linknum') =~ /^(\d+)$/ or die "Illegal linknum: ". $cgi->param('linknum'); my $linknum = $1; @@ -39,7 +37,7 @@ $cgi->param('link') =~ /^(custnum|invnum|popup)$/ my $field = my $link = $1; $field = 'custnum' if $field eq 'popup'; -my $_date = str2time($cgi->param('_date')); +my $_date = parse_datetime($cgi->param('_date')); my $new = new FS::cust_pay ( { $field => $linknum, @@ -47,11 +45,18 @@ my $new = new FS::cust_pay ( { map { $_, scalar($cgi->param($_)); } qw( paid payby payinfo paybatch - pkgnum + pkgnum discount_term ) #} fields('cust_pay') } ); +my @rights = ('Post payment'); +push @rights, 'Post check payment' if $new->payby eq 'BILL'; +push @rights, 'Post cash payment' if $new->payby eq 'CASH'; + +die "access denied" + unless $FS::CurrentUser::CurrentUser->access_right(\@rights); + my $error = $new->insert( 'manual' => 1 );