From: Alex Brelsfoard Date: Tue, 10 Feb 2015 05:33:22 +0000 (-0500) Subject: RT #31482 you can now change the tax class when modifying a one-time charge. X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=commitdiff_plain;h=1d4ea4545c4a86a0664feb537f06aa5eb7f54c07 RT #31482 you can now change the tax class when modifying a one-time charge. --- diff --git a/FS/FS/cust_pkg.pm b/FS/FS/cust_pkg.pm index 48cc187f2..b0cc2a3cd 100644 --- a/FS/FS/cust_pkg.pm +++ b/FS/FS/cust_pkg.pm @@ -2486,6 +2486,12 @@ sub modify_charge { } # else simply ignore them; the UI shouldn't allow editing the fields + if ( exists($opt{'taxclass'}) + and $part_pkg->taxclass ne $opt{'taxclass'}) { + + $part_pkg->set('taxclass', $opt{'taxclass'}); + } + my $error; if ( $part_pkg->modified or $pkg_opt_modified ) { # can we safely modify the package def? diff --git a/httemplate/edit/process/quick-charge.cgi b/httemplate/edit/process/quick-charge.cgi index c130a550f..aa6010ef9 100644 --- a/httemplate/edit/process/quick-charge.cgi +++ b/httemplate/edit/process/quick-charge.cgi @@ -67,6 +67,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->exists('enable_taxproducts') && + ( $override || $param->{taxproductnum} ) + ); + $cgi->param('taxclass', ''); + } $error = $cust_pkg->modify_charge( 'pkg' => scalar($cgi->param('pkg')), @@ -75,6 +87,10 @@ 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, ); diff --git a/httemplate/edit/quick-charge.html b/httemplate/edit/quick-charge.html index 05a375ac7..64ee97bb9 100644 --- a/httemplate/edit/quick-charge.html +++ b/httemplate/edit/quick-charge.html @@ -171,6 +171,17 @@ function bill_now_changed (what) { &> % } +% unless ($billed) { + + <% mt('Tax exempt') |h %> + param('setuptax') ? 'CHECKED' : '' %>> + + +<& /elements/tr-select-taxclass.html, 'curr_value' => $part_pkg->get('taxclass') &> + +<& /elements/tr-select-taxproduct.html, 'label' => emt('Tax product'), 'onclick' => 'parent.taxproductmagic(this);', 'curr_value' => $part_pkg->get('taxproductnum') &> +% } + % } else { # new one-time charge