X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=FS%2FFS%2Fqueue.pm;h=df92c5654f23b2f79584b3e18db3add21e42a62c;hp=c75f7587441b7942a471e3686e2198374c9813d6;hb=b26a63c1a75b80652506f39a99a6786193d956bf;hpb=eb7c552dd8290d6b33a4e026c5dc21ebf01105cf diff --git a/FS/FS/queue.pm b/FS/FS/queue.pm index c75f75874..df92c5654 100644 --- a/FS/FS/queue.pm +++ b/FS/FS/queue.pm @@ -232,13 +232,26 @@ sub cust_svc { qsearchs('cust_svc', { 'svcnum' => $self->svcnum } ); } +=item queue_depend + +Returns the FS::queue_depend objects associated with this job, if any. + +=cut + +sub queue_depend { + my $self = shift; + qsearch('queue_depend', { 'jobnum' => $self->jobnum } ); +} + + =item depend_insert OTHER_JOBNUM -Inserts a dependancy for this job. If there is an error, returns the error, -otherwise returns false. +Inserts a dependancy for this job - it will not be run until the other job +specified completes. If there is an error, returns the error, otherwise +returns false. -When using job dependancies, you should wrap the insertion of jobs in a -database transaction. +When using job dependancies, you should wrap the insertion of all relevant jobs +in a database transaction. =cut @@ -303,6 +316,11 @@ END my $date = time2str( "%a %b %e %T %Y", $queue->_date ); my $status = $queue->status; $status .= ': '. $queue->statustext if $queue->statustext; + my @queue_depend = $queue->queue_depend; + $status .= ' (waiting for '. + join(', ', map { $_->other_jobnum } @queue_depend ). + ')' + if @queue_depend; my $changable = $dangerous || ( ! $noactions && $status =~ /^failed/ || $status =~ /^locked/ ); if ( $changable ) { @@ -360,7 +378,7 @@ END =head1 VERSION -$Id: queue.pm,v 1.12 2002-05-15 13:24:24 ivan Exp $ +$Id: queue.pm,v 1.13 2002-05-15 14:00:32 ivan Exp $ =head1 BUGS