summaryrefslogtreecommitdiff
path: root/FS
diff options
context:
space:
mode:
authorJonathan Prykop <jonathan@freeside.biz>2015-08-24 17:23:33 -0500
committerJonathan Prykop <jonathan@freeside.biz>2015-08-24 17:32:29 -0500
commit80b60d8b0c9f18407e8b63ace60a59c9dd70bc9d (patch)
tree8b3b26e870b6a2cd5933a78ce5e9ccda7d1bded1 /FS
parent415583a28981b3ce76344f583d8cb71ab847be25 (diff)
RT#14829: automatic payments triggered by bill now show up as Payment by fs_queue [fixed local CurrentUser]
Diffstat (limited to 'FS')
-rw-r--r--FS/FS/queue.pm27
-rw-r--r--FS/bin/freeside-queued11
2 files changed, 19 insertions, 19 deletions
diff --git a/FS/FS/queue.pm b/FS/FS/queue.pm
index f7f0948..67d124d 100644
--- a/FS/FS/queue.pm
+++ b/FS/FS/queue.pm
@@ -364,19 +364,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 }) || ();
-}
+# not needed in 4
+#=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
diff --git a/FS/bin/freeside-queued b/FS/bin/freeside-queued
index 398b03d..36871b2 100644
--- a/FS/bin/freeside-queued
+++ b/FS/bin/freeside-queued
@@ -218,13 +218,12 @@ while (1) {
# don't put @args in the log, may expose passwords
$log->info('starting job ('.$ljob->job.')');
warn 'running "&'. $ljob->job. '('. join(', ', @args). ")\n" if $DEBUG;
- # switch user only if a job user is available
- my $oldCurrentUser = $FS::CurrentUser::CurrentUser;
- my $jobuser = $ljob->access_user;
- local $FS::CurrentUser::CurrentUser = $jobuser if $jobuser;
local $FS::UID::AutoCommit = 0; # so that we can clean up failures
- eval $eval; #throw away return value? suppose so
- $FS::CurrentUser::CurrentUser = $oldCurrentUser if $jobuser;
+ do {
+ # switch user only if a job user is available
+ local $FS::CurrentUser::CurrentUser = $ljob->access_user || $FS::CurrentUser::CurrentUser;
+ eval $eval; #throw away return value? suppose so
+ };
if ( $@ ) {
dbh->rollback;
my %hash = $ljob->hash;