diff options
Diffstat (limited to 'httemplate/edit/process/cust_credit.cgi')
-rwxr-xr-x | httemplate/edit/process/cust_credit.cgi | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/httemplate/edit/process/cust_credit.cgi b/httemplate/edit/process/cust_credit.cgi new file mode 100755 index 000000000..85bfd4489 --- /dev/null +++ b/httemplate/edit/process/cust_credit.cgi @@ -0,0 +1,26 @@ +<% + +$cgi->param('custnum') =~ /^(\d*)$/ or die "Illegal custnum!"; +my $custnum = $1; + +my $new = new FS::cust_credit ( { + map { + $_, scalar($cgi->param($_)); + } fields('cust_credit') +} ); + +my $error = $new->insert; + +if ( $error ) { + $cgi->param('error', $error); + print $cgi->redirect(popurl(2). "cust_credit.cgi?". $cgi->query_string ); +} else { + if ( $cgi->param('apply') eq 'yes' ) { + my $cust_main = qsearchs('cust_main', { 'custnum' => $custnum }) + or die "unknown custnum $custnum"; + $cust_main->apply_credits; + } + print $cgi->redirect(popurl(3). "view/cust_main.cgi?$custnum"); +} + +%> |