X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=httemplate%2Fedit%2Fprocess%2Fquick-charge.cgi;h=484f6fcc64b4cf0a1fa21b5a1eea9b1541e0ad22;hb=9bdca2fe23584918219395b62effbb9ef0fc5f1c;hp=4c4927f4d26b995eabef91671a8f13d70943e6c9;hpb=1203e278e2ec38fcf1468da2e4f10862004bebeb;p=freeside.git diff --git a/httemplate/edit/process/quick-charge.cgi b/httemplate/edit/process/quick-charge.cgi index 4c4927f4d..484f6fcc6 100644 --- a/httemplate/edit/process/quick-charge.cgi +++ b/httemplate/edit/process/quick-charge.cgi @@ -14,6 +14,7 @@ die "access denied" unless $FS::CurrentUser::CurrentUser->access_right('One-time charge'); my $error = ''; +my $conf = new FS::conf; my $param = $cgi->Vars; my @description = (); @@ -26,7 +27,7 @@ $param->{"custnum"} =~ /^(\d+)$/ or $error .= "Illegal customer number " . $param->{"custnum"} . " "; my $custnum = $1; -$param->{"amount"} =~ /^\s*(\d+(\.\d{1,2})?)\s*$/ +$param->{"amount"} =~ /^\s*(\d*(?:\.?\d{1,2}))\s*$/ or $error .= "Illegal amount " . $param->{"amount"} . " "; my $amount = $1; @@ -35,8 +36,16 @@ if ( $cgi->param('quantity') =~ /^\s*(\d+)\s*$/ ) { $quantity = $1; } +$param->{'tax_override'} =~ /^\s*([,\d]*)\s*$/ + or $error .= "Illegal tax override " . $param->{"tax_override"} . " "; +my $override = $1; + if ( $param->{'taxclass'} eq '(select)' ) { - $error .= "Must select a tax class. "; + $error .= "Must select a tax class. " + unless ($conf->exists('enable_taxproducts') && + ( $override || $param->{taxproductnum} ) + ); + $cgi->param('taxclass', ''); } unless ( $error ) { @@ -44,12 +53,22 @@ unless ( $error ) { or $error .= "Unknown customer number $custnum. "; $error ||= $cust_main->charge( { - 'amount' => $amount, - 'quantity' => $quantity, - 'pkg' => scalar($cgi->param('pkg')), - 'taxclass' => scalar($cgi->param('taxclass')), - 'classnum' => scalar($cgi->param('classnum')), - 'additional' => \@description, + 'amount' => $amount, + 'quantity' => $quantity, + 'bill_now' => scalar($cgi->param('bill_now')), + 'invoice_terms' => scalar($cgi->param('invoice_terms')), + 'start_date' => ( scalar($cgi->param('start_date')) + ? parse_datetime($cgi->param('start_date')) + : '' + ), + 'no_auto' => scalar($cgi->param('no_auto')), + 'pkg' => scalar($cgi->param('pkg')), + 'setuptax' => scalar($cgi->param('setuptax')), + 'taxclass' => scalar($cgi->param('taxclass')), + 'taxproductnum' => scalar($cgi->param('taxproductnum')), + 'tax_override' => $override, + 'classnum' => scalar($cgi->param('classnum')), + 'additional' => \@description, } ); }