diff options
author | Ivan Kohler <ivan@freeside.biz> | 2014-12-04 14:47:49 -0800 |
---|---|---|
committer | Jeremy Davis <jeremyd@freeside.biz> | 2014-12-09 13:49:11 -0500 |
commit | fa868107440f645205e7943fd370fb48e677f091 (patch) | |
tree | 0921bb1508ddd36e9fcd2b8a33e95e0378f7bf71 /httemplate/edit/process | |
parent | 0f69a0c57be1409ddc1714eec396f1bc4080b75d (diff) |
backdate credits, RT#32320
Diffstat (limited to 'httemplate/edit/process')
-rwxr-xr-x | httemplate/edit/process/cust_credit.cgi | 15 |
1 files changed, 12 insertions, 3 deletions
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; } |