From: Mark Wells Date: Mon, 29 Aug 2016 21:23:13 +0000 (-0700) Subject: retain report classes when editing package defs, #71904 X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=commitdiff_plain;h=04e01775639ae8ec9d604d4b48f2e7b2ce2a95ca retain report classes when editing package defs, #71904 --- 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); +# } }