2 % foreach my $pkgpart (keys %error) {
3 % # stuff all the errors back into $cgi
4 % $cgi->param("error$pkgpart", $error{$pkgpart});
6 % my $session = int(rand(4294967296)); #XXX
7 % my $pref = new FS::access_user_pref({
8 % 'usernum' => $FS::CurrentUser::CurrentUser->usernum,
9 % 'prefname' => "redirect$session",
10 % 'prefvalue' => $cgi->query_string,
11 % 'expiration' => time + 3600, #1h? 1m?
13 % my $pref_error = $pref->insert;
14 % if ( $pref_error ) {
15 % die "FATAL: couldn't even set redirect cookie: $pref_error".
16 % " attempting to set redirect$session to ". $cgi->query_string."\n";
18 <% $cgi->redirect($fsurl.'browse/part_pkg-fcc.html?redirect='.$session) %>
20 <% $cgi->redirect($dest) %>
23 my $curuser = $FS::CurrentUser::CurrentUser;
24 my $edit_acl = $curuser->access_right('Edit FCC report configuration');
25 my $global_edit_acl = $curuser->access_right('Edit FCC report configuration for all agents');
26 die "access denied" unless $edit_acl or $global_edit_acl;
28 # non-atomic; report errors but allow successful changes to go through
29 # not that I even know how you'd get an error doing this
32 foreach my $param ($cgi->param) {
33 $param =~ /^pkgpart(\d+)$/ or next;
35 my $part_pkg = FS::part_pkg->by_key($pkgpart);
36 my $hashref = decode_json( $cgi->param($param) );
37 my $error = $part_pkg->set_fcc_options($hashref);
38 $error{$pkgpart} = $error if $error;
41 my $dest = $fsurl.'browse/part_pkg-fcc.html?';
42 foreach (qw(classnum maxrecords offset)) {
43 if ( $cgi->param($_) =~ /^(\d+)$/ ) {
48 if ( $cgi->param('jump') =~ /^pkgpart(\d+)$/ ) {