From 2dddd8e1742bf2e8ebe9f2d3e560bc78bba95cff Mon Sep 17 00:00:00 2001 From: Jonathan Prykop Date: Thu, 20 Aug 2015 01:42:15 -0500 Subject: RT#14829: automatic payments triggered by bill now show up as Payment by fs_queue --- FS/bin/freeside-queued | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'FS/bin/freeside-queued') diff --git a/FS/bin/freeside-queued b/FS/bin/freeside-queued index 7c4cf1b64..398b03d12 100644 --- a/FS/bin/freeside-queued +++ b/FS/bin/freeside-queued @@ -218,8 +218,13 @@ 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; if ( $@ ) { dbh->rollback; my %hash = $ljob->hash; -- cgit v1.2.1