summaryrefslogtreecommitdiff
path: root/httemplate/edit/part_pkg.cgi
diff options
context:
space:
mode:
authorIvan Kohler <ivan@freeside.biz>2012-12-26 10:05:31 -0800
committerIvan Kohler <ivan@freeside.biz>2012-12-26 10:05:31 -0800
commitb9fcddbb0539d7632c7e6660ef0d568277a63f49 (patch)
tree2dbff06a609f0de5b1acdba8bd9b9aa5a272abf2 /httemplate/edit/part_pkg.cgi
parentd7e62d5ea2b5d3f3c7b8ba3da39cce1a606dc3d3 (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 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{$_})