projects
/
freeside.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
suspend event option to skip packages with a start_date, RT#83847
[freeside.git]
/
FS
/
FS
/
queue.pm
diff --git
a/FS/FS/queue.pm
b/FS/FS/queue.pm
index
99e349c
..
9bbaf34
100644
(file)
--- a/
FS/FS/queue.pm
+++ b/
FS/FS/queue.pm
@@
-12,7
+12,7
@@
use FS::Record qw( qsearch qsearchs dbh );
use FS::queue_arg;
use FS::queue_depend;
use FS::cust_svc;
use FS::queue_arg;
use FS::queue_depend;
use FS::cust_svc;
-use FS::CGI qw
(rooturl);
+use FS::CGI qw(rooturl);
@ISA = qw(FS::Record);
@EXPORT_OK = qw( joblisting );
@ISA = qw(FS::Record);
@EXPORT_OK = qw( joblisting );
@@
-67,6
+67,20
@@
Job status (new, locked, or failed)
Freeform text status message
Freeform text status message
+=cut
+
+sub statustext {
+ my $self = shift;
+ if ( defined ( $_[0] ) ) {
+ $self->SUPER::statustext(@_);
+ } else {
+ my $value = $self->SUPER::statustext();
+ my $rooturl = rooturl();
+ $value =~ s/%%%ROOTURL%%%/$rooturl/g;
+ $value;
+ }
+}
+
=item _date
UNIX timestamp
=item _date
UNIX timestamp
@@
-84,6
+98,10
@@
Optional link to customer (see L<FS::cust_main>).
Secure flag, 'Y' indicates that when using encryption, the job needs to be
run on a machine with the private key.
Secure flag, 'Y' indicates that when using encryption, the job needs to be
run on a machine with the private key.
+=item usernum
+
+For access_user that created the job
+
=cut
=back
=cut
=back
@@
-138,6
+156,8
@@
sub insert {
$self->custnum( $args{'custnum'} ) if $args{'custnum'};
$self->custnum( $args{'custnum'} ) if $args{'custnum'};
+ $self->usernum($FS::CurrentUser::CurrentUser->usernum) unless $self->usernum;
+
my $error = $self->SUPER::insert;
if ( $error ) {
$dbh->rollback if $oldAutoCommit;
my $error = $self->SUPER::insert;
if ( $error ) {
$dbh->rollback if $oldAutoCommit;
@@
-249,6
+269,7
@@
sub check {
|| $self->ut_enum('status',['', qw( new locked failed done )])
|| $self->ut_anything('statustext')
|| $self->ut_numbern('svcnum')
|| $self->ut_enum('status',['', qw( new locked failed done )])
|| $self->ut_anything('statustext')
|| $self->ut_numbern('svcnum')
+ || $self->ut_foreign_keyn('usernum', 'access_user', 'usernum')
;
return $error if $error;
;
return $error if $error;
@@
-363,7
+384,7
@@
If there is an error, returns the error, otherwise returns false.
use vars qw($_update_statustext_dbh);
sub update_statustext {
my( $self, $statustext ) = @_;
use vars qw($_update_statustext_dbh);
sub update_statustext {
my( $self, $statustext ) = @_;
- return '' if $statustext eq $self->
statustext;
+ return '' if $statustext eq $self->
get('statustext'); #avoid rooturl expansion
warn "updating statustext for $self to $statustext" if $DEBUG;
$_update_statustext_dbh ||= myconnect;
warn "updating statustext for $self to $statustext" if $DEBUG;
$_update_statustext_dbh ||= myconnect;
@@
-374,7
+395,7
@@
sub update_statustext {
$sth->execute($statustext, $self->jobnum) or return $sth->errstr;
$_update_statustext_dbh->commit or die $_update_statustext_dbh->errstr;
$sth->execute($statustext, $self->jobnum) or return $sth->errstr;
$_update_statustext_dbh->commit or die $_update_statustext_dbh->errstr;
- $self->s
tatustext($statustext);
+ $self->s
et('statustext', $statustext); #avoid rooturl expansion
'';
#my $new = new FS::queue { $self->hash };
'';
#my $new = new FS::queue { $self->hash };
@@
-385,6
+406,20
@@
sub update_statustext {
#'';
}
#'';
}
+=item access_user
+
+Returns FS::access_user object (if any) associated with this user.
+
+Returns nothing if not found.
+
+=cut
+
+sub access_user {
+ my $self = shift;
+ my $usernum = $self->usernum || return ();
+ return qsearchs('access_user',{ 'usernum' => $usernum }) || ();
+}
+
=back
=head1 SUBROUTINES
=back
=head1 SUBROUTINES