diff options
author | ivan <ivan> | 2005-01-27 10:21:18 +0000 |
---|---|---|
committer | ivan <ivan> | 2005-01-27 10:21:18 +0000 |
commit | 6cf964d0dc008621fb30fd2da28e2c44f29c6364 (patch) | |
tree | 74fd5536bb89960db22d03cc95b6374711de60ef /FS/FS/queue.pm | |
parent | e4ae5122522f2d45c68a38eaef337a82029f2fc1 (diff) |
DHTML progress bar for glacial rate adding and editing, closes: Bug#1100
Diffstat (limited to 'FS/FS/queue.pm')
-rw-r--r-- | FS/FS/queue.pm | 35 |
1 files changed, 33 insertions, 2 deletions
diff --git a/FS/FS/queue.pm b/FS/FS/queue.pm index dcac3c6..f42d998 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; @@ -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 |