Bug 30889: Set userenv for background jobs
We need to set the userenv when we process the jobs. It is useful for stats (at least) Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
This commit is contained in:
parent
6c315c164d
commit
0f2425a243
1 changed files with 15 additions and 1 deletions
|
@ -121,6 +121,20 @@ sub process_job {
|
|||
|
||||
die "fork failed!" unless defined $pid;
|
||||
|
||||
$job->process( $args );
|
||||
my $patron = Koha::Patrons->find($job->borrowernumber);
|
||||
if ( $patron ) {
|
||||
C4::Context->_new_userenv(-1);
|
||||
C4::Context->set_userenv(
|
||||
$patron->borrowernumber, $patron->userid,
|
||||
$patron->cardnumber, $patron->firstname,
|
||||
$patron->surname, $patron->branchcode,
|
||||
$patron->library->branchname, $patron->flags
|
||||
);
|
||||
$job->process( $args );
|
||||
C4::Context->_unset_userenv(-1);
|
||||
} ese {
|
||||
$job->process( $args );
|
||||
}
|
||||
|
||||
exit;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue