X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=httemplate%2Fedit%2Fprocess%2Fcust_pay.cgi;h=d85267cb157c582d4fa48621985969e8927b7b48;hp=d6bbf06b023c225cc1da91a1fbc6e3546b46f7c7;hb=76b22e66bf8e615def0a24cd8cda23c3949eae70;hpb=0fb307c305e4bc2c9c27dc25a3308beae3a4d33c diff --git a/httemplate/edit/process/cust_pay.cgi b/httemplate/edit/process/cust_pay.cgi index d6bbf06b0..d85267cb1 100755 --- a/httemplate/edit/process/cust_pay.cgi +++ b/httemplate/edit/process/cust_pay.cgi @@ -7,13 +7,14 @@ % 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,6 +28,8 @@ %} <%init> +my $conf = FS::Conf->new; + $cgi->param('linknum') =~ /^(\d+)$/ or die "Illegal linknum: ". $cgi->param('linknum'); my $linknum = $1; @@ -36,17 +39,27 @@ $cgi->param('link') =~ /^(custnum|invnum|popup)$/ my $field = my $link = $1; $field = 'custnum' if $field eq 'popup'; -my $_date = parse_datetime($cgi->param('_date')); +my $_date; +if ( $FS::CurrentUser::CurrentUser->access_right('Backdate payment') ) { + $_date = parse_datetime($cgi->param('_date')); +} +else { + $_date = time; +} my $new = new FS::cust_pay ( { $field => $linknum, _date => $_date, + no_auto_apply => ($cgi->param('apply') eq 'never') ? 'Y' : '', map { $_, scalar($cgi->param($_)); } qw( paid payby payinfo paybatch pkgnum discount_term + bank depositor account teller ) #} fields('cust_pay') + # gatewaynum, processor, auth, order_number + # are for realtime payments only, and can't be entered manually } ); my @rights = ('Post payment'); @@ -56,6 +69,6 @@ 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 ); +my $error ||= $new->insert( 'manual' => 1 );