1 <% include( 'elements/search.html',
2 'title' => 'Job Queue',
3 'menubar' => [ 'Main menu' => $p, ],
5 'html_form' => qq!<FORM NAME="jobForm" ACTION="$p/misc/queue.cgi" METHOD="POST">!,
6 'query' => { 'table' => 'queue',
8 'extra_sql' => 'ORDER BY jobnum',
10 'count_query' => $count_query,
16 'Account', # unless $hashref->{'svcnum'}
25 || $queue->job !~ /^FS::part_export::/
29 encode_entities( join(' ', $queue->args) );
35 time2str( "%a %b %e %T %Y", shift->_date );
39 my $jobnum = $queue->jobnum;
40 my $status = $queue->status;
41 $status .= ': '. $queue->statustext
42 if $queue->statustext;
43 my @queue_depend = $queue->queue_depend;
44 $status .= ' (waiting for '.
45 join(', ', map { $_->depend_jobnum }
50 my $changable = $dangerous
52 && $status =~ /^failed/
53 || $status =~ /^locked/
57 qq! ( <A HREF="$p/misc/queue.cgi?jobnum=$jobnum&action=new">retry</A> |!.
58 qq! <A HREF="$p/misc/queue.cgi?jobnum=$jobnum&action=del">remove</A> )!;
64 # return '' if $hashref->{'svcnum'}
65 my $cust_svc = $queue->cust_svc;
68 my $table = $cust_svc->part_svc->svcdb;
69 my $label = ( $cust_svc->label )[1];
70 qq!<A HREF="../view/$table.cgi?!. $queue->svcnum.
78 my $jobnum = $queue->jobnum;
79 my $status = $queue->status;
80 my $changable = $dangerous
82 && $status eq 'failed'
83 || $status eq 'locked'
87 qq!<INPUT NAME="jobnum$jobnum" TYPE="checkbox" VALUE="1">!;
104 '<BR><INPUT TYPE="button" VALUE="select all" onClick="setAll(true)">'.
105 '<INPUT TYPE="button" VALUE="unselect all" onClick="setAll(false)">'.
106 '<BR><INPUT TYPE="submit" NAME="action" VALUE="retry selected">'.
107 '<INPUT TYPE="submit" NAME="action" VALUE="remove selected"><BR>'.
108 '<SCRIPT TYPE="text/javascript">'.
109 ' function setAll(setTo) { '.
110 ' theForm = document.jobForm;'.
111 ' for (i=0,n=theForm.elements.length;i<n;i++)'.
112 ' if (theForm.elements[i].name.indexOf("jobnum") != -1)'.
113 ' theForm.elements[i].checked = setTo;'.
126 unless $FS::CurrentUser::CurrentUser->access_right('Job queue');
130 my $conf = new FS::Conf;
131 my $dangerous = $conf->exists('queue_dangerous_controls');
135 my $count_query = 'SELECT COUNT(*) FROM queue'; # + $hashref