blob: 8ef33082977b98b9d6b26364b916b60b26f9c295 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
% 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.$jump) %>
% }
<%init>
my $curuser = $FS::CurrentUser::CurrentUser;
my $edit_acl = $curuser->access_right('Edit FCC report configuration');
my $global_edit_acl = $curuser->access_right('Edit FCC report configuration for all agents');
die "access denied" unless $edit_acl or $global_edit_acl;
# 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');
my $jump = '';
if ( $cgi->param('jump') =~ /^pkgpart(\d+)$/ ) {
$jump = '#'.$1;
}
</%init>
|