+ my $part_pkg = $cust_pkg->part_pkg;
+ die "pkgnum $pkgnum is not a one-time charge" unless $part_pkg->freq eq '0';
+
+ my ($amount, $setup_cost, $quantity);
+ if ( $cgi->param('amount') =~ /^\s*(\d*(\.\d{1,2})*)\s*$/ ) {
+ $amount = sprintf('%.2f', $1);
+ }
+ if ( $cgi->param('setup_cost') =~ /^\s*(\d*(\.\d{1,2})*)\s*$/ ) {
+ $setup_cost = sprintf('%.2f', $1);
+ }
+ if ( $cgi->param('quantity') =~ /^\s*(\d*)\s*$/ ) {
+ $quantity = $1 || 1;
+ }
+
+ 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')),
+ 'classnum' => scalar($cgi->param('classnum')),
+ 'additional' => \@description,
+ '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')),