summaryrefslogtreecommitdiff
path: root/httemplate/edit/part_pkg.cgi
diff options
context:
space:
mode:
authorIvan Kohler <ivan@freeside.biz>2012-12-26 10:05:33 -0800
committerIvan Kohler <ivan@freeside.biz>2012-12-26 10:05:33 -0800
commita52b5b3e54dca30f56fba7eb4905f6bc50171fcd (patch)
tree628a52e77408dfc59d5a2835b1399f55c88150ca /httemplate/edit/part_pkg.cgi
parentce69838d46f32a59b54afb529f6517074e0cbd31 (diff)
fix report classes when cloning, RT#20753
Diffstat (limited to 'httemplate/edit/part_pkg.cgi')
-rwxr-xr-xhttemplate/edit/part_pkg.cgi39
1 files changed, 24 insertions, 15 deletions
diff --git a/httemplate/edit/part_pkg.cgi b/httemplate/edit/part_pkg.cgi
index 0f597b214..38505b5f3 100755
--- a/httemplate/edit/part_pkg.cgi
+++ b/httemplate/edit/part_pkg.cgi
@@ -405,20 +405,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) {
@@ -441,6 +429,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))
@@ -480,13 +487,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{$_})