X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=FS%2FFS%2Fqueue.pm;h=5f8bf11f037f8855f00ba1b2f13b167934e24a3c;hb=efc68f41987d007de5e792b88df1c63bf3dedf4c;hp=9dcb2e3be72597017fe7668d6eadd85e27f98009;hpb=eb9668a6f3181ee02cb335272c5ee4616e61fd09;p=freeside.git diff --git a/FS/FS/queue.pm b/FS/FS/queue.pm index 9dcb2e3be..5f8bf11f0 100644 --- a/FS/FS/queue.pm +++ b/FS/FS/queue.pm @@ -3,7 +3,7 @@ package FS::queue; 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; @@ -15,7 +15,6 @@ use FS::cust_svc; @EXPORT_OK = qw( joblisting ); $DEBUG = 0; -#$DEBUG = 1; $FS::UID::callback{'FS::queue'} = sub { $conf = new FS::Conf; @@ -69,7 +68,7 @@ FS::Record. The following fields are currently supported: =item new HASHREF -Creates a new job. To add the example to the database, see L<"insert">. +Creates a new job. To add the job to the database, see L<"insert">. Note that this stores the hash reference, not a distinct copy of the hash it points to. You can ask the object for a copy with the I method. @@ -307,6 +306,38 @@ sub depended_delete { } } +=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 @@ -352,9 +383,7 @@ END 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 = ''; } @@ -422,10 +451,6 @@ END =back -=head1 VERSION - -$Id: queue.pm,v 1.17 2004-03-03 13:42:08 ivan Exp $ - =head1 BUGS $jobnums global