use strict;
use vars qw( @ISA @EXPORT_OK $DEBUG $conf $jobnums);
use Exporter;
-use FS::UID;
+use FS::UID qw(myconnect);
use FS::Conf;
use FS::Record qw( qsearch qsearchs dbh );
#use FS::queue;
@EXPORT_OK = qw( joblisting );
$DEBUG = 0;
-#$DEBUG = 1;
$FS::UID::callback{'FS::queue'} = sub {
$conf = new FS::Conf;
}
}
+=item update_statustext VALUE
+
+Updates the statustext value of this job to supplied value, in the database.
+If there is an error, returns the error, otherwise returns false.
+
+=cut
+
+use vars qw($_update_statustext_dbh);
+sub update_statustext {
+ my( $self, $statustext ) = @_;
+ return '' if $statustext eq $self->statustext;
+ warn "updating statustext for $self to $statustext" if $DEBUG;
+
+ $_update_statustext_dbh ||= myconnect;
+
+ my $sth = $_update_statustext_dbh->prepare(
+ 'UPDATE queue set statustext = ? WHERE jobnum = ?'
+ ) or return $_update_statustext_dbh->errstr;
+
+ $sth->execute($statustext, $self->jobnum) or return $sth->errstr;
+ $_update_statustext_dbh->commit or die $_update_statustext_dbh->errstr;
+ $self->statustext($statustext);
+ '';
+
+ #my $new = new FS::queue { $self->hash };
+ #$new->statustext($statustext);
+ #my $error = $new->replace($self);
+ #return $error if $error;
+ #$self->statustext($statustext);
+ #'';
+}
+
=back
=head1 SUBROUTINES
my $args;
if ( $dangerous || $queue->job !~ /^FS::part_export::/ || !$noactions ) {
- $args = encode_entities( join(' ',
- map { length($_)<54 ? $_ : substr($_,0,32)."..." } $queue->args #1&g
- ) );
+ $args = encode_entities( join(' ', $queue->args) );
} else {
$args = '';
}
=back
-=head1 VERSION
-
-$Id: queue.pm,v 1.17 2004-03-03 13:42:08 ivan Exp $
-
=head1 BUGS
$jobnums global