X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;ds=sidebyside;f=httemplate%2Fedit%2Fprocess%2Fcust_bill_pay.cgi;h=0025b16b586730dd8831b67b6c9b8564ccfc6038;hb=b3e85cf7a5a514f185c7d9c5ba50550c759c9ab5;hp=16d30bd4cefaa60e6bc78437e4461f19b7f925fb;hpb=1fd6d8cf5d7854860ef4fd10ed89828e0c04ec39;p=freeside.git diff --git a/httemplate/edit/process/cust_bill_pay.cgi b/httemplate/edit/process/cust_bill_pay.cgi index 16d30bd4c..0025b16b5 100755 --- a/httemplate/edit/process/cust_bill_pay.cgi +++ b/httemplate/edit/process/cust_bill_pay.cgi @@ -1,4 +1,3 @@ - <% $cgi->param('paynum') =~ /^(\d*)$/ or die "Illegal paynum!"; @@ -12,12 +11,24 @@ my $cust_main = qsearchs('cust_main', { 'custnum' => $cust_pay->custnum } ) my $custnum = $cust_main->custnum; -my $new = new FS::cust_bill_pay ( { - map { - $_, scalar($cgi->param($_)); - #} qw(custnum _date amount invnum) - } fields('cust_bill_pay') -} ); +my $new; +if ($cgi->param('invnum') =~ /^Refund$/) { + $new = new FS::cust_refund ( { + 'reason' => 'Refunding payment', #enter reason in UI + 'refund' => $cgi->param('amount'), + 'payby' => 'BILL', + #'_date' => $cgi->param('_date'), + 'payinfo' => 'Cash', #enter payinfo in UI + 'paynum' => $paynum, + } ); +} else { + $new = new FS::cust_bill_pay ( { + map { + $_, scalar($cgi->param($_)); + #} qw(custnum _date amount invnum) + } fields('cust_bill_pay') + } ); +} my $error = $new->insert;