X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=httemplate%2Fedit%2Fprocess%2Fcust_credit.cgi;h=0b93c64e5e4a79d8d2c137bbe3989e0d018f949f;hb=1fc8addc56f8daf12397da568eb1ac1b27fd3984;hp=e442d7fa65dfa86d080c24348c5bdfc8f78af475;hpb=8dd41f364aaba88969dfd0908feb22709025e7f6;p=freeside.git diff --git a/httemplate/edit/process/cust_credit.cgi b/httemplate/edit/process/cust_credit.cgi index e442d7fa6..0b93c64e5 100755 --- a/httemplate/edit/process/cust_credit.cgi +++ b/httemplate/edit/process/cust_credit.cgi @@ -14,9 +14,9 @@ % % $dbh->commit or die $dbh->errstr if $oldAutoCommit; % -<% header(emt('Credit successful')) %> +<& /elements/header-popup.html, emt('Credit successful') &> @@ -42,11 +42,20 @@ if (!$reasonnum) { } $cgi->param('reasonnum', $reasonnum) unless $error; +my $_date; +if ( $FS::CurrentUser::CurrentUser->access_right('Backdate credit') ) { + $_date = parse_datetime($cgi->param('_date')); +} +else { + $_date = time; +} + +my @fields = grep { $_ ne '_date' } fields('cust_credit'); + unless ($error) { my $new = new FS::cust_credit ( { - map { - $_, scalar($cgi->param($_)); - } fields('cust_credit') + _date => $_date, + map { $_ => scalar($cgi->param($_)) } @fields } ); $error = $new->insert; }