X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=httemplate%2Fedit%2Fprocess%2Fpart_pkg.cgi;h=669b75946a126175f1d2e23697f5d760422189b3;hb=0269c850cfefc00d5da255f88c63a314e1ab6cd0;hp=faaedf9db21b08120095b54b4a3837e1f13cf90a;hpb=e4fc461dd93181e8199d5cc5e2de2a11732b1bfd;p=freeside.git diff --git a/httemplate/edit/process/part_pkg.cgi b/httemplate/edit/process/part_pkg.cgi index faaedf9db..669b75946 100755 --- a/httemplate/edit/process/part_pkg.cgi +++ b/httemplate/edit/process/part_pkg.cgi @@ -38,10 +38,10 @@ my $precheck_callback = sub { push @agents, $1 if $1; } return "At least one agent type must be specified." - unless( scalar(@agents) || - $cgi->param('clone') && $cgi->param('clone') =~ /^\d+$/ || - !$cgi->param('pkgpart') && $conf->exists('agent-defaultpkg') - ); + unless scalar(@agents) + || ( $cgi->param('clone') && $cgi->param('clone') =~ /^\d+$/ ) + || ( !$cgi->param('pkgpart') && $conf->exists('agent-defaultpkg') ) + || $cgi->param('disabled'); return ''; @@ -84,6 +84,13 @@ my $args_callback = sub { } @options; + foreach ( split(',', $cgi->param('taxproductnums') ) ) { + my $value = $cgi->param("taxproductnum_$_"); + $error ||= "Illegal taxproductnum_$_: $value" + unless ( $value =~ /^\d*$/ ); + $options{"usage_taxproductnum_$_"} = $value; + } + $options{$_} = scalar( $cgi->param($_) ) for (qw( setup_fee recur_fee )); @@ -146,6 +153,22 @@ my @process_m2m = ( }, ); +foreach my $override_class ($cgi->param) { + next unless $override_class =~ /^tax_override_(\w+)$/; + my $class = $1; + + my (@tax_overrides) = (grep "$_", split (",", $1)) + if $cgi->param($override_class) =~ /^([\d,]+)$/; + + push @process_m2m, { + 'link_table' => 'part_pkg_taxoverride', + 'target_table' => 'tax_class', + 'hashref' => { 'usage_class' => $class }, + 'params' => [ @tax_overrides ], + }; + +} + my $conf = new FS::Conf; if ( $cgi->param('pkgpart') || ! $conf->exists('agent_defaultpkg') ) {