X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=httemplate%2Fedit%2Fprocess%2Fcust_credit.cgi;h=39c6f19972a8c3b4bbfece4ef04543b5eb6e59d3;hb=a16891c16e0ddd389b32963b638cdfeadf86c447;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..39c6f1997 100755 --- a/httemplate/edit/process/cust_credit.cgi +++ b/httemplate/edit/process/cust_credit.cgi @@ -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; }