diff options
author | ivan <ivan> | 2002-04-13 08:51:54 +0000 |
---|---|---|
committer | ivan <ivan> | 2002-04-13 08:51:54 +0000 |
commit | f70985da9714a8a2c5dd87f56d891ed0197ef590 (patch) | |
tree | f9c95bdd40f9f2444fa46d9bb595aed50e8c02d9 /httemplate/misc | |
parent | 81faa8d34d1287a61fd723d73ab02a022cf5d050 (diff) |
bulk queue operations (closes: Bug#389)
Diffstat (limited to 'httemplate/misc')
-rw-r--r-- | httemplate/misc/queue.cgi | 33 |
1 files changed, 27 insertions, 6 deletions
diff --git a/httemplate/misc/queue.cgi b/httemplate/misc/queue.cgi index 7e962d498..8c1e5362d 100644 --- a/httemplate/misc/queue.cgi +++ b/httemplate/misc/queue.cgi @@ -1,13 +1,17 @@ <% -$cgi->param('jobnum') =~ /^(\d+)$/ or die "Illegal jobnum"; -my $jobnum = $1; -my $job = qsearchs('queue', { 'jobnum' => $1 }) - or die "unknown jobnum $jobnum"; - -$cgi->param('action') =~ /^(new|del)$/ or die "Illegal action"; +$cgi->param('action') =~ /^(new|del|(retry|remove) selected)$/ + or die "Illegal action"; my $action = $1; +my $job; +if ( $action eq 'new' || $action eq 'del' ) { + $cgi->param('jobnum') =~ /^(\d+)$/ or die "Illegal jobnum"; + my $jobnum = $1; + $job = qsearchs('queue', { 'jobnum' => $1 }) + or die "unknown jobnum $jobnum"; +} + if ( $action eq 'new' ) { my %hash = $job->hash; $hash{'status'} = 'new'; @@ -18,6 +22,23 @@ if ( $action eq 'new' ) { } elsif ( $action eq 'del' ) { my $error = $job->delete; die $error if $error; +} elsif ( $action =~ /^(retry|remove) selected$/ ) { + foreach my $jobnum ( + map { /^jobnum(\d+)$/; $1; } grep /^jobnum\d+$/, $cgi->param + ) { + my $job = qsearchs('queue', { 'jobnum' => $jobnum }); + if ( $action eq 'retry selected' && $job ) { #new + my %hash = $job->hash; + $hash{'status'} = 'new'; + $hash{'statustext'} = ''; + my $new = new FS::queue \%hash; + my $error = $new->replace($job); + die $error if $error; + } elsif ( $action eq 'remove selected' && $job ) { #del + my $error = $job->delete; + die $error if $error; + } + } } print $cgi->redirect(popurl(2). "browse/queue.cgi"); |