<% include( 'elements/search.html', 'title' => 'Job Queue', 'name' => 'jobs', 'html_form' => qq!!, 'query' => { 'table' => 'queue', 'hashref' => $hashref, 'order_by' => 'ORDER BY jobnum', }, 'count_query' => $count_query, 'header' => [ '#', 'Job', 'Args', 'Date', 'Status', 'Account', # unless $hashref->{'svcnum'} '', # checkbox column ], 'fields' => [ 'jobnum', 'job', sub { my $queue = shift; if ( $dangerous || $queue->job !~ /^FS::part_export::/ || !$noactions ) { encode_entities( join(' ', $queue->args) ); } else { ''; } }, sub { time2str( "%a %b %e %T %Y", shift->_date ); }, sub { my $queue = shift; my $jobnum = $queue->jobnum; my $status = $queue->status; $status .= ': '. $queue->statustext if $queue->statustext; my @queue_depend = $queue->queue_depend; $status .= ' (waiting for '. join(', ', map { $_->depend_jobnum } @queue_depend ). ')' if @queue_depend; my $changable = $dangerous || ( ! $noactions && $status =~ /^failed/ || $status =~ /^locked/ || $status =~ /^done/ ); if ( $changable ) { $status .= qq! (!; $status .= qq! retry |! unless $status =~ /^done/; $status .= qq! remove )!; } $status; }, sub { my $queue = shift; # return '' if $hashref->{'svcnum'} my $cust_svc = $queue->cust_svc; my $account; if ( $cust_svc ) { my $table = $cust_svc->part_svc->svcdb; my $label = ( $cust_svc->label )[1]; qq!$label!; } else { ''; } }, sub { my $queue = shift; my $jobnum = $queue->jobnum; my $status = $queue->status; my $changable = $dangerous || ( ! $noactions && $status eq 'failed' || $status eq 'locked' ); if ( $changable ) { $areboxes = 1; qq!!; } else { ''; } }, ], #'links' => [ # '', # '', # '', # '', # '', # '', #$acct_link, # '', # ], 'html_foot' => sub { if ( $areboxes ) { '
'. ''. '
'. '
'. '
'; } else { ''; } }, ) %> <%init> die "access denied" unless $FS::CurrentUser::CurrentUser->access_right('Job queue'); my $hashref = {}; my $conf = new FS::Conf; my $dangerous = $conf->exists('queue_dangerous_controls'); my $noactions = 0; my $count_query = 'SELECT COUNT(*) FROM queue'; # + $hashref my $areboxes = 0;