X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=FS%2FFS%2Fqueue.pm;h=9bbaf3431202f47b94870acfb45822909aeb3d1c;hb=653545aa57687de24286d0955a047cb20f6e0c54;hp=3f8763da8dcca766307ed6a53fea783aaa88fbf6;hpb=1702ffad58949ebe9e4769afeb9fe9c93249cf69;p=freeside.git diff --git a/FS/FS/queue.pm b/FS/FS/queue.pm index 3f8763da8..9bbaf3431 100644 --- a/FS/FS/queue.pm +++ b/FS/FS/queue.pm @@ -98,6 +98,10 @@ Optional link to customer (see L). 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 @@ -152,6 +156,8 @@ sub insert { $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; @@ -263,6 +269,7 @@ sub check { || $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; @@ -399,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