X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;ds=sidebyside;f=httemplate%2Fedit%2Fprocess%2Fcust_credit_bill.cgi;h=17f9fcb35589a22dfb37afd6afe3e671424bafd2;hb=e8384f16694d6c7f094bdc7a1506c29dbf7f1417;hp=4879b0eabdd2f53147edcfbbead2677a02277e88;hpb=22a35047ecdffff80110e06cc08fc84f9ddba9b0;p=freeside.git diff --git a/httemplate/edit/process/cust_credit_bill.cgi b/httemplate/edit/process/cust_credit_bill.cgi index 4879b0eab..17f9fcb35 100755 --- a/httemplate/edit/process/cust_credit_bill.cgi +++ b/httemplate/edit/process/cust_credit_bill.cgi @@ -1,4 +1,18 @@ -<% +%if ( $error ) { +% $cgi->param('error', $error); +<% $cgi->redirect(popurl(2). "cust_credit_bill.cgi?". $cgi->query_string ) %> +%} else { +<% header('Credit application sucessful') %> + + + +% } +<%init> + +die "access denied" + unless $FS::CurrentUser::CurrentUser->access_right('Apply credit'); $cgi->param('crednum') =~ /^(\d*)$/ or die "Illegal crednum!"; my $crednum = $1; @@ -14,11 +28,12 @@ my $custnum = $cust_main->custnum; my $new; if ($cgi->param('invnum') =~ /^Refund$/) { $new = new FS::cust_refund ( { - 'reason' => $cust_credit->reason, + 'reason' => ( $cust_credit->reason || 'refund from credit' ), 'refund' => $cgi->param('amount'), 'payby' => 'BILL', - '_date' => $cgi->param('_date'), - 'payinfo' => 'Cash', + #'_date' => $cgi->param('_date'), + #'payinfo' => 'Cash', + 'payinfo' => 'Refund', 'crednum' => $crednum, } ); } else { @@ -32,12 +47,4 @@ if ($cgi->param('invnum') =~ /^Refund$/) { my $error = $new->insert; -if ( $error ) { - $cgi->param('error', $error); - print $cgi->redirect(popurl(2). "cust_credit_bill.cgi?". $cgi->query_string ); -} else { - print $cgi->redirect(popurl(3). "view/cust_main.cgi?$custnum"); -} - - -%> +