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