package FS::queue;
use strict;
-use vars qw( @ISA @EXPORT_OK );
+use vars qw( @ISA @EXPORT_OK $conf );
use Exporter;
+use FS::UID;
+use FS::Conf;
use FS::Record qw( qsearch qsearchs dbh );
#use FS::queue;
use FS::queue_arg;
@ISA = qw(FS::Record);
@EXPORT_OK = qw( joblisting );
+$FS::UID::callback{'FS::queue'} = sub {
+ $conf = new FS::Conf;
+};
+
=head1 NAME
FS::queue - Object methods for queue records
my @queue = qsearch( 'queue', $hashref );
return '' unless scalar(@queue);
- my $html = FS::CGI::table(). <<END;
+ my $p = FS::CGI::popurl(2);
+
+ my $html = qq!<FORM ACTION="$p/misc/queue.cgi" METHOD="POST">!.
+ FS::CGI::table(). <<END;
<TR>
<TH COLSPAN=2>Job</TH>
<TH>Args</TH>
$html .= '<TH>Account</TH>' unless $hashref->{svcnum};
$html .= '</TR>';
- my $p = FS::CGI::popurl(2);
+ my $dangerous = $conf->exists('queue_dangerous_controls');
+
+ my $areboxes = 0;
+
foreach my $queue ( sort {
$a->getfield('jobnum') <=> $b->getfield('jobnum')
} @queue ) {
my $queue_hashref = $queue->hashref;
my $jobnum = $queue->jobnum;
- my $args = join(' ', $queue->args);
+
+ my $args;
+ if ( $dangerous || $queue->job !~ /^FS::part_export::/ || !$noactions ) {
+ $args = join(' ', $queue->args);
+ } else {
+ $args = '';
+ }
+
my $date = time2str( "%a %b %e %T %Y", $queue->_date );
my $status = $queue->status;
$status .= ': '. $queue->statustext if $queue->statustext;
- if ( ! $noactions && $status =~ /^failed/ || $status =~ /^locked/ ) {
+ my $changable = $dangerous
+ || ( ! $noactions && $status =~ /^failed/ || $status =~ /^locked/ );
+ if ( $changable ) {
$status .=
qq! ( <A HREF="$p/misc/queue.cgi?jobnum=$jobnum&action=new">retry</A> |!.
qq! <A HREF="$p/misc/queue.cgi?jobnum=$jobnum&action=del">remove</A> )!;
$html .= "<TD>$account</TD>";
}
+ if ( $changable ) {
+ $areboxes=1;
+ $html .=
+ qq!<TD><INPUT NAME="jobnum$jobnum" TYPE="checkbox" VALUE="1"></TD>!;
+
+ }
+
$html .= '</TR>';
}
$html .= '</TABLE>';
+ if ( $areboxes ) {
+ $html .= '<BR><INPUT TYPE="submit" NAME="action" VALUE="retry selected">'.
+ '<INPUT TYPE="submit" NAME="action" VALUE="remove selected"><BR>';
+ }
+
$html;
}
=head1 VERSION
-$Id: queue.pm,v 1.8 2002-03-23 16:16:00 ivan Exp $
+$Id: queue.pm,v 1.11 2002-04-13 08:51:54 ivan Exp $
=head1 BUGS