diff options
author | Jonathan Prykop <jonathan@freeside.biz> | 2015-08-24 17:23:33 -0500 |
---|---|---|
committer | Jonathan Prykop <jonathan@freeside.biz> | 2015-08-24 17:32:29 -0500 |
commit | 80b60d8b0c9f18407e8b63ace60a59c9dd70bc9d (patch) | |
tree | 8b3b26e870b6a2cd5933a78ce5e9ccda7d1bded1 /FS/bin/freeside-queued | |
parent | 415583a28981b3ce76344f583d8cb71ab847be25 (diff) |
RT#14829: automatic payments triggered by bill now show up as Payment by fs_queue [fixed local CurrentUser]
Diffstat (limited to 'FS/bin/freeside-queued')
-rw-r--r-- | FS/bin/freeside-queued | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/FS/bin/freeside-queued b/FS/bin/freeside-queued index 398b03d12..36871b295 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; |