X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=FS%2FFS%2Fqueue.pm;h=5719eff70b795082229306450d42ad71d066996f;hb=327df8aefdcf96c9c83805570abf4cc242cf46b9;hp=83ae17189e017151f681d4c8dabd27f8eb575e22;hpb=8f42b751aebda2e7dce2c363bed6f1e15b411b1d;p=freeside.git diff --git a/FS/FS/queue.pm b/FS/FS/queue.pm index 83ae17189..5719eff70 100644 --- a/FS/FS/queue.pm +++ b/FS/FS/queue.pm @@ -1,8 +1,10 @@ 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; @@ -11,6 +13,10 @@ use FS::cust_svc; @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 @@ -78,6 +84,7 @@ created (see L). =cut +#false laziness w/part_export.pm sub insert { my $self = shift; @@ -185,10 +192,12 @@ sub check { || $self->ut_enum('status',['', qw( new locked failed )]) || $self->ut_textn('statustext') || $self->ut_numbern('svcnum') - || $self->ut_foreign_keyn('svcnum', 'cust_svc', 'svcnum') ; return $error if $error; + $error = $self->ut_foreign_keyn('svcnum', 'cust_svc', 'svcnum'); + $self->svcnum('') if $error; + $self->status('new') unless $self->status; $self->_date(time) unless $self->_date; @@ -219,7 +228,7 @@ sub cust_svc { qsearchs('cust_svc', { 'svcnum' => $self->svcnum } ); } -=item joblisting HASHREF +=item joblisting HASHREF NOACTIONS =cut @@ -229,56 +238,91 @@ sub joblisting { use Date::Format; use FS::CGI; - my $html = FS::CGI::table(). <!. + FS::CGI::table(). < Job Args Date Status - Account - END + $html .= 'Account' unless $hashref->{svcnum}; + $html .= ''; + + my $dangerous = $conf->exists('queue_dangerous_controls'); + + my $areboxes = 0; - my $p = FS::CGI::popurl(2); foreach my $queue ( sort { $a->getfield('jobnum') <=> $b->getfield('jobnum') - } qsearch( 'queue', $hashref ) ) { - my $hashref = $queue->hashref; + } @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! ( retry |!. - qq! remove )!; + qq! ( retry |!. + qq! remove )!; } my $cust_svc = $queue->cust_svc; - my $account; - if ( $cust_svc ) { - my $table = $cust_svc->part_svc->svcdb; - my $label = ( $cust_svc->label )[1]; - $account = qq!$label!; - } else { - $account = ''; - } + $html .= < $jobnum - $hashref->{job} + $queue_hashref->{job} $args $date $status - $account - END + unless ( $hashref->{svcnum} ) { + my $account; + if ( $cust_svc ) { + my $table = $cust_svc->part_svc->svcdb; + my $label = ( $cust_svc->label )[1]; + $account = qq!$label!; + } else { + $account = ''; + } + $html .= "$account"; + } + + if ( $changable ) { + $areboxes=1; + $html .= + qq!!; + + } + + $html .= ''; + } $html .= ''; + if ( $areboxes ) { + $html .= '
'. + '
'; + } + $html; } @@ -287,7 +331,7 @@ END =head1 VERSION -$Id: queue.pm,v 1.4 2002-02-20 01:03:09 ivan Exp $ +$Id: queue.pm,v 1.11 2002-04-13 08:51:54 ivan Exp $ =head1 BUGS