diff options
author | Mark Wells <mark@freeside.biz> | 2016-08-29 14:23:13 -0700 |
---|---|---|
committer | Mark Wells <mark@freeside.biz> | 2016-08-29 18:31:49 -0700 |
commit | 4cddc2516b02ea66015ac04c835e64419d0e3052 (patch) | |
tree | 5a443363017724f996ca45dc1c5ba9a288bd668c /httemplate | |
parent | b178e8c996031020ae8687ee254507dad303a43c (diff) |
retain report classes when editing package defs, #71904
Diffstat (limited to 'httemplate')
-rwxr-xr-x | httemplate/edit/part_pkg.cgi | 36 |
1 files changed, 25 insertions, 11 deletions
diff --git a/httemplate/edit/part_pkg.cgi b/httemplate/edit/part_pkg.cgi index 7fe659f94..e08f0e1a1 100755 --- a/httemplate/edit/part_pkg.cgi +++ b/httemplate/edit/part_pkg.cgi @@ -326,6 +326,7 @@ 'name_col' => 'name', 'hashref' => { 'disabled' => '' }, 'multiple' => 1, + 'curr_value_callback' => $report_option_value_callback, }, { 'type' => 'tablebreak-tr-title', @@ -563,29 +564,42 @@ my $new_object_callback = sub { }; +my $report_option_value_callback = sub { + my ($cgi, $object) = @_; + my @report_option; + if ( defined $cgi->param('report_option') ) { + @report_option = $cgi->param('report_option'); + } else { + foreach ($object->options) { + /^report_option_(\d+)$/ && (push @report_option, $1); + } + } + join(',', @report_option); +}; + sub set_report_option { my($cgi, $object, $fields ) = @_; #, $opt my @report_option = (); foreach ($object->options) { /^usage_taxproductnum_(\d+)$/ && ($taxproductnums{$1} = 1); - /^report_option_(\d+)$/ && (push @report_option, $1); +# /^report_option_(\d+)$/ && (push @report_option, $1); } foreach ($object->part_pkg_taxoverride) { $taxproductnums{$_->usage_class} = 1 if $_->usage_class; } - $cgi->param('report_option', join(',', @report_option)); - foreach my $field ( @$fields ) { - next unless ( - ref($field) eq 'HASH' && - $field->{field} && - $field->{field} eq 'report_option' - ); - #$field->{curr_value} = join(',', @report_option); - $field->{value} = join(',', @report_option); - } +# $cgi->param('report_option', join(',', @report_option)); +# foreach my $field ( @$fields ) { +# next unless ( +# ref($field) eq 'HASH' && +# $field->{field} && +# $field->{field} eq 'report_option' +# ); +# #$field->{curr_value} = join(',', @report_option); +# $field->{value} = join(',', @report_option); +# } } |