Bugzilla – Attachment 132853 Details for
Bug 30345
Koha::BackgroundJob->enqueue should set borrowernumber=undef if no userenv
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 30345: Make Koha::BackgroundJob->enqueue set borrowernumber=undef if no userenv
Bug-30345-Make-KohaBackgroundJob-enqueue-set-borro.patch (text/plain), 1.72 KB, created by
Kyle M Hall (khall)
on 2022-04-01 12:24:44 UTC
(
hide
)
Description:
Bug 30345: Make Koha::BackgroundJob->enqueue set borrowernumber=undef if no userenv
Filename:
MIME Type:
Creator:
Kyle M Hall (khall)
Created:
2022-04-01 12:24:44 UTC
Size:
1.72 KB
patch
obsolete
>From fce4d98daaca82bdba0260dde7dbda09fa2f84e2 Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Wed, 23 Mar 2022 15:47:38 -0300 >Subject: [PATCH] Bug 30345: Make Koha::BackgroundJob->enqueue set > borrowernumber=undef if no userenv > >This patch makes ->enqueue set undef if no userenv is provided. The CLI >scripts will usually use Koha::Script and have this set to undef as >well, but on the tests, there's usually no userenv set unless we need to >test it. And as we are adding triggers everywhere, that will schedule >background jobs, it means we would end up mocking userenv or the >->enqueue method everywhere and it will get messy. > >This patch just make it set undef. > >To test: >1. Apply the regression tests patch >2. Run: > $ kshell > k$ prove t/db_dependent/Koha/BackgroundJob.t >=> FAIL: Wow, it explodes badly. Same as any test that happens to >trigger a background job enqueuing. >3. Apply this patch >4. Repeat 2 >=> SUCCESS: Great, tests pass! >5. Sign off :-D > >Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> > >Signed-off-by: Arthur Suzuki <arthur.suzuki@biblibre.com> > >Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> >--- > Koha/BackgroundJob.pm | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > >diff --git a/Koha/BackgroundJob.pm b/Koha/BackgroundJob.pm >index b8c010924d..b22da6d0a3 100644 >--- a/Koha/BackgroundJob.pm >+++ b/Koha/BackgroundJob.pm >@@ -98,7 +98,7 @@ sub enqueue { > my $job_size = $params->{job_size}; > my $job_args = $params->{job_args}; > >- my $borrowernumber = C4::Context->userenv->{number}; # FIXME Handle non GUI calls >+ my $borrowernumber = (C4::Context->userenv) ? C4::Context->userenv->{number} : undef; > my $json_args = encode_json $job_args; > > $self->set( >-- >2.30.2
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 30345
:
132074
|
132075
|
132243
|
132244
|
132824
|
132825
|
132851
|
132852
| 132853