From b9fcddbb0539d7632c7e6660ef0d568277a63f49 Mon Sep 17 00:00:00 2001 From: Ivan Kohler Date: Wed, 26 Dec 2012 10:05:31 -0800 Subject: [PATCH] fix report classes when cloning, RT#20753 --- httemplate/edit/part_pkg.cgi | 39 ++++++++++++++++++++++++--------------- 1 file changed, 24 insertions(+), 15 deletions(-) diff --git a/httemplate/edit/part_pkg.cgi b/httemplate/edit/part_pkg.cgi index 50aeb4595..c3f4f88b6 100755 --- a/httemplate/edit/part_pkg.cgi +++ b/httemplate/edit/part_pkg.cgi @@ -409,20 +409,8 @@ my $new_object_callback = sub { }; -my $edit_callback = sub { - my( $cgi, $object, $fields, $opt ) = @_; - - $setup_show_zero_disabled = ($object->option('setup_fee') > 0) ? 1 : 0; - - $recur_disabled = $object->freq ? 0 : 1; - - $recur_show_zero_disabled = - $object->freq - ? $object->option('recur_fee') > 0 ? 1 : 0 - : 1; - - (@agent_type) = - map {$_->typenum} qsearch('type_pkgs', { 'pkgpart' => $object->pkgpart } ); +sub set_report_option { + my($cgi, $object, $fields ) = @_; #, $opt my @report_option = (); foreach ($object->options) { @@ -445,6 +433,25 @@ my $edit_callback = sub { $field->{value} = join(',', @report_option); } +} + +my $edit_callback = sub { + my( $cgi, $object, $fields, $opt ) = @_; + + $setup_show_zero_disabled = ($object->option('setup_fee') > 0) ? 1 : 0; + + $recur_disabled = $object->freq ? 0 : 1; + + $recur_show_zero_disabled = + $object->freq + ? $object->option('recur_fee') > 0 ? 1 : 0 + : 1; + + (@agent_type) = + map {$_->typenum} qsearch('type_pkgs', { 'pkgpart' => $object->pkgpart } ); + + set_report_option( $cgi, $object, $fields); + %options = $object->options; $object->set($_ => $object->option($_, 1)) @@ -484,13 +491,15 @@ my $clone_callback = sub { $object->disabled('Y'); - } else { #not when cloning... + } else { #when explicitly cloning, not customizing (@agent_type) = map {$_->typenum} qsearch('type_pkgs',{ 'pkgpart' => $object->pkgpart } ); } + set_report_option( $cgi, $object, $fields); + %options = $object->options; $object->set($_ => $options{$_}) -- 2.11.0