[freeside-commits] branch master updated. ed3c8f7e9284bcfafd37c8c693084ab12f8f9f40

Jonathan Prykop jonathan at 420.am
Mon Aug 24 15:24:24 PDT 2015


The branch, master has been updated
       via  ed3c8f7e9284bcfafd37c8c693084ab12f8f9f40 (commit)
      from  2dddd8e1742bf2e8ebe9f2d3e560bc78bba95cff (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit ed3c8f7e9284bcfafd37c8c693084ab12f8f9f40
Author: Jonathan Prykop <jonathan at freeside.biz>
Date:   Mon Aug 24 17:23:33 2015 -0500

    RT#14829: automatic payments triggered by bill now show up as Payment by fs_queue [fixed local CurrentUser]

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;

-----------------------------------------------------------------------

Summary of changes:
 FS/FS/queue.pm         |   27 ++++++++++++++-------------
 FS/bin/freeside-queued |   11 +++++------
 2 files changed, 19 insertions(+), 19 deletions(-)




More information about the freeside-commits mailing list