X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=FS%2Fbin%2Ffreeside-queued;h=36871b295f24d9216e19d52d9d79adc5e7174de8;hp=70d85348384e8df22d22998830bcc70204509593;hb=bb7e827141c9ed68f30765c9ca2ddcd1d760ad2d;hpb=7caec8842cb8959515204b45aef368f243e87e33 diff --git a/FS/bin/freeside-queued b/FS/bin/freeside-queued index 70d853483..36871b295 100644 --- a/FS/bin/freeside-queued +++ b/FS/bin/freeside-queued @@ -196,7 +196,7 @@ while (1) { dbh->{'private_profile'} = {} if UNIVERSAL::can(dbh, 'sprintProfile'); #auto-use classes... - if ( $ljob->job =~ /(FS::(part_export|cust_main|cust_pkg|Cron)::\w+)::/ + if ( $ljob->job =~ /(FS::(part_export|cust_main|cust_pkg|part_pkg|Cron)::\w+)::/ || $ljob->job =~ /(FS::\w+)::/ ) { @@ -219,7 +219,11 @@ while (1) { $log->info('starting job ('.$ljob->job.')'); warn 'running "&'. $ljob->job. '('. join(', ', @args). ")\n" if $DEBUG; local $FS::UID::AutoCommit = 0; # so that we can clean up failures - eval $eval; #throw away return value? suppose so + 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;