summaryrefslogtreecommitdiff
path: root/httemplate/edit/process/bulk-part_pkg.html
diff options
context:
space:
mode:
authorMark Wells <mark@freeside.biz>2013-08-15 00:08:24 -0700
committerMark Wells <mark@freeside.biz>2013-08-15 00:08:24 -0700
commit4771c3a939c45be1cc2814a5d4c2696cb55212f0 (patch)
treed5108cd50381b294074ccd1a93d23e135ee64dc6 /httemplate/edit/process/bulk-part_pkg.html
parentec34946605aefd8455b4d7a8bd197d8eabe7ce3c (diff)
fix some UI issues with the report class bulk edit, #24070
Diffstat (limited to 'httemplate/edit/process/bulk-part_pkg.html')
-rw-r--r--httemplate/edit/process/bulk-part_pkg.html23
1 files changed, 14 insertions, 9 deletions
diff --git a/httemplate/edit/process/bulk-part_pkg.html b/httemplate/edit/process/bulk-part_pkg.html
index 4775a9334..f546701e8 100644
--- a/httemplate/edit/process/bulk-part_pkg.html
+++ b/httemplate/edit/process/bulk-part_pkg.html
@@ -10,21 +10,26 @@ die "access denied" unless $FS::CurrentUser::CurrentUser->access_right('Bulk edi
my @pkgparts = $cgi->param('pkgpart')
or die "no package definitions selected";
-my %changes;
+my %delete = map { 'report_option_'.($_->num) => 1 }
+ qsearch('part_pkg_report_option', {});
+my %insert;
+
foreach my $param (grep { /^report_option_\d+$/ } $cgi->param) {
- if ( length($cgi->param($param)) ) {
- if ( $cgi->param($param) == 1 ) {
- $changes{$param} = 1;
- } else {
- $changes{$param} = '';
- }
- }
+ if ( $cgi->param($param) == 1 ) {
+ $insert{$param} = 1;
+ delete $delete{$param};
+ } elsif ( $cgi->param($param) == -1 ) {
+ # leave it alone
+ delete $delete{$param};
+ } # else it's empty, so leave it on the delete list
}
+
my $error;
foreach my $pkgpart (@pkgparts) {
my $part_pkg = FS::part_pkg->by_key($pkgpart);
- my %options = ( $part_pkg->options, %changes );
+ my %options = ( $part_pkg->options, %insert );
+ delete $options{$_} foreach keys(%delete);
$error ||= $part_pkg->replace( options => \%options );
}
</%init>