diff options
author | Mark Wells <mark@freeside.biz> | 2014-08-05 15:54:51 -0700 |
---|---|---|
committer | Mark Wells <mark@freeside.biz> | 2014-08-05 15:54:51 -0700 |
commit | d7cf0d6bb3b81b1c91ef1bcc3252d56f96b65b0f (patch) | |
tree | 1a527c06c1336bb6a81b3839bbd480122cec73de /httemplate/edit/process/bulk-part_pkg-fcc.html | |
parent | 0f359d5480aa1621d73ee802f420e8951abc620d (diff) |
477 report: improve browse-edit UI
Diffstat (limited to 'httemplate/edit/process/bulk-part_pkg-fcc.html')
-rw-r--r-- | httemplate/edit/process/bulk-part_pkg-fcc.html | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/httemplate/edit/process/bulk-part_pkg-fcc.html b/httemplate/edit/process/bulk-part_pkg-fcc.html new file mode 100644 index 000000000..17579aa61 --- /dev/null +++ b/httemplate/edit/process/bulk-part_pkg-fcc.html @@ -0,0 +1,42 @@ +% if ( keys %error ) { +% foreach my $pkgpart (keys %error) { +% # stuff all the errors back into $cgi +% $cgi->param("error$pkgpart", $error{$pkgpart}); +% } +% my $session = int(rand(4294967296)); #XXX +% my $pref = new FS::access_user_pref({ +% 'usernum' => $FS::CurrentUser::CurrentUser->usernum, +% 'prefname' => "redirect$session", +% 'prefvalue' => $cgi->query_string, +% 'expiration' => time + 3600, #1h? 1m? +% }); +% my $pref_error = $pref->insert; +% if ( $pref_error ) { +% die "FATAL: couldn't even set redirect cookie: $pref_error". +% " attempting to set redirect$session to ". $cgi->query_string."\n"; +% } +<% $cgi->redirect($fsurl.'browse/part_pkg-fcc.html?redirect='.$session) %> +% } else { +<% $cgi->redirect($fsurl.'browse/part_pkg-fcc.html?classnum='.$classnum) %> +% } +<%init> +my $curuser = $FS::CurrentUser::CurrentUser; +die "access denied" + unless $curuser->access_right('Bulk edit package definitions'); + +# non-atomic; report errors but allow successful changes to go through +# not that I even know how you'd get an error doing this + +my %error; +foreach my $param ($cgi->param) { + $param =~ /^pkgpart(\d+)$/ or next; + my $pkgpart = $1; + my $part_pkg = FS::part_pkg->by_key($pkgpart); + my $hashref = decode_json( $cgi->param($param) ); + my $error = $part_pkg->set_fcc_options($hashref); + $error{$pkgpart} = $error if $error; +} + +my $classnum = $cgi->param('classnum'); + +</%init> |