1 <% $cgi->redirect(popurl(2). "search/queue.html") %>
5 unless $FS::CurrentUser::CurrentUser->access_right('Job queue');
7 $cgi->param('action') =~ /^(new|del|(retry|remove) selected)$/
8 or die "Illegal action";
12 if ( $action eq 'new' || $action eq 'del' ) {
13 $cgi->param('jobnum') =~ /^(\d+)$/ or die "Illegal jobnum";
15 $job = qsearchs('queue', { 'jobnum' => $1 })
16 or die "unknown jobnum $jobnum - ".
17 "it probably completed normally or was removed by another user";
20 if ( $action eq 'new' ) {
21 my %hash = $job->hash;
22 $hash{'status'} = 'new';
23 $hash{'statustext'} = '';
24 my $new = new FS::queue \%hash;
25 my $error = $new->replace($job);
27 } elsif ( $action eq 'del' ) {
28 my $error = $job->delete;
30 } elsif ( $action =~ /^(retry|remove) selected$/ ) {
32 map { /^jobnum(\d+)$/; $1; } grep /^jobnum\d+$/, $cgi->param
34 my $job = qsearchs('queue', { 'jobnum' => $jobnum });
35 if ( $action eq 'retry selected' && $job ) { #new
36 my %hash = $job->hash;
37 $hash{'status'} = 'new';
38 $hash{'statustext'} = '';
39 my $new = new FS::queue \%hash;
40 my $error = $new->replace($job);
42 } elsif ( $action eq 'remove selected' && $job ) { #del
43 my $error = $job->delete;