From 6924a1488d0ec5e64f2dc5a7f9b927464515c068 Mon Sep 17 00:00:00 2001 From: Mark Wells Date: Thu, 15 Aug 2013 00:13:56 -0700 Subject: fix some UI issues with the report class bulk edit, #24070 --- httemplate/edit/process/bulk-part_pkg.html | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) (limited to 'httemplate/edit/process/bulk-part_pkg.html') 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 ); } -- cgit v1.2.1 From 22a2961bb218bd7f02606ce17a56186b7c107239 Mon Sep 17 00:00:00 2001 From: Mark Wells Date: Thu, 15 Aug 2013 10:02:26 -0700 Subject: fix spelling errors --- httemplate/edit/process/bulk-part_pkg.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'httemplate/edit/process/bulk-part_pkg.html') diff --git a/httemplate/edit/process/bulk-part_pkg.html b/httemplate/edit/process/bulk-part_pkg.html index f546701e8..bc5137cdd 100644 --- a/httemplate/edit/process/bulk-part_pkg.html +++ b/httemplate/edit/process/bulk-part_pkg.html @@ -1,6 +1,6 @@ % if ( $error ) { % $cgi->param('error', $error); -<% $cgi->redirect(popurl(3).'/edit/bulk-part_pkg.cgi?', $cgi->query_string) %> +<% $cgi->redirect(popurl(3).'/edit/bulk-part_pkg.html?', $cgi->query_string) %> % } else { <% $cgi->redirect(popurl(3).'/browse/part_pkg.cgi') %> % } -- cgit v1.2.1 From 81fbbbd132ec70b81719399aa07d7a6f2606ba6f Mon Sep 17 00:00:00 2001 From: Mark Wells Date: Thu, 15 Aug 2013 14:32:56 -0700 Subject: fix error handling path, #24070 --- httemplate/edit/process/bulk-part_pkg.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'httemplate/edit/process/bulk-part_pkg.html') diff --git a/httemplate/edit/process/bulk-part_pkg.html b/httemplate/edit/process/bulk-part_pkg.html index bc5137cdd..59c914a5d 100644 --- a/httemplate/edit/process/bulk-part_pkg.html +++ b/httemplate/edit/process/bulk-part_pkg.html @@ -1,6 +1,6 @@ % if ( $error ) { % $cgi->param('error', $error); -<% $cgi->redirect(popurl(3).'/edit/bulk-part_pkg.html?', $cgi->query_string) %> +<% $cgi->redirect(popurl(3).'/edit/bulk-part_pkg.html?'.$cgi->query_string) %> % } else { <% $cgi->redirect(popurl(3).'/browse/part_pkg.cgi') %> % } -- cgit v1.2.1