X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=httemplate%2Fedit%2Fprocess%2Fquick-charge.cgi;h=39628cae7dd8f4a070877b5a676bc2be4b696989;hb=a078c5a126b4a4cac8aa259dd04e51f302787a18;hp=c130a550fc8964998de225b63b43fe3a63214807;hpb=f92a083465019a7224d912cd78b6881f8aef1b52;p=freeside.git diff --git a/httemplate/edit/process/quick-charge.cgi b/httemplate/edit/process/quick-charge.cgi index c130a550f..39628cae7 100644 --- a/httemplate/edit/process/quick-charge.cgi +++ b/httemplate/edit/process/quick-charge.cgi @@ -1,13 +1,4 @@ -% if ( $error ) { -% $cgi->param('error', $error ); -<% $cgi->redirect($p.'quick-charge.html?'. $cgi->query_string) %> -% } else { -<% header(emt($message)) %> - - -% } +<% $cgi->redirect(@redirect) %> <%init> my $curuser = $FS::CurrentUser::CurrentUser; @@ -67,6 +58,18 @@ if ( $param->{'pkgnum'} =~ /^(\d+)$/ ) { #modifying an existing one-time charge my $start_date = $cgi->param('start_date') ? parse_datetime($cgi->param('start_date')) : time; + + $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. " + unless ($conf->config('tax_data_vendor') && + ( $override || $param->{taxproductnum} ) + ); + $cgi->param('taxclass', ''); + } $error = $cust_pkg->modify_charge( 'pkg' => scalar($cgi->param('pkg')), @@ -75,8 +78,13 @@ if ( $param->{'pkgnum'} =~ /^(\d+)$/ ) { #modifying an existing one-time charge 'adjust_commission' => ($cgi->param('adjust_commission') ? 1 : 0), 'amount' => $amount, 'setup_cost' => $setup_cost, + 'setuptax' => scalar($cgi->param('setuptax')), + 'taxclass' => scalar($cgi->param('taxclass')), + 'taxproductnum' => scalar($cgi->param('taxproductnum')), + 'tax_override' => $override, 'quantity' => $quantity, 'start_date' => $start_date, + 'separate_bill' => scalar($cgi->param('separate_bill')), ); } else { # the usual case: new one-time charge @@ -105,7 +113,7 @@ if ( $param->{'pkgnum'} =~ /^(\d+)$/ ) { #modifying an existing one-time charge if ( $param->{'taxclass'} eq '(select)' ) { $error .= "Must select a tax class. " - unless ($conf->exists('enable_taxproducts') && + unless ($conf->config('tax_data_vendor') && ( $override || $param->{taxproductnum} ) ); $cgi->param('taxclass', ''); @@ -122,6 +130,7 @@ if ( $param->{'pkgnum'} =~ /^(\d+)$/ ) { #modifying an existing one-time charge : '' ), 'no_auto' => scalar($cgi->param('no_auto')), + 'separate_bill' => scalar($cgi->param('separate_bill')), 'pkg' => scalar($cgi->param('pkg')), 'setuptax' => scalar($cgi->param('setuptax')), 'taxclass' => scalar($cgi->param('taxclass')), @@ -139,4 +148,27 @@ if ( $param->{'pkgnum'} =~ /^(\d+)$/ ) { #modifying an existing one-time charge } +my @redirect = (); +if ( $error ) { + $cgi->param('error', $error ); + @redirect = ( $p.'quick-charge.html?'. $cgi->query_string ); +} elsif ( $quotation ) { + @redirect = ( + -uri => $fsurl.'view/quotation.html?' . $quotation->quotationnum, + -cookie => CGI::Cookie->new( -name => 'freeside_status', + -value => mt('One-time charge added to quotation'), + -expires => '+5m', + ), + ); +} else { + @redirect = ( + -uri => $fsurl.'view/cust_main.cgi?custnum='. $cust_main->custnum. + ';show=last', + -cookie => CGI::Cookie->new( -name => 'freeside_status', + -value => mt('One-time charge ordered'), + -expires => '+5m', + ), + ); +} +