Bugzilla – Attachment 132075 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.65 KB, created by
Tomás Cohen Arazi (tcohen)
on 2022-03-23 18:52:49 UTC
(
hide
)
Description:
Bug 30345: Make Koha::BackgroundJob->enqueue set borrowernumber=undef if no userenv
Filename:
MIME Type:
Creator:
Tomás Cohen Arazi (tcohen)
Created:
2022-03-23 18:52:49 UTC
Size:
1.65 KB
patch
obsolete
>From 689ec49d6d03a548c37bb44c50f1b7ae46c05fd6 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> >--- > Koha/BackgroundJob.pm | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > >diff --git a/Koha/BackgroundJob.pm b/Koha/BackgroundJob.pm >index 46fa01e861..140b992e64 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; > my $job_id; > $self->_result->result_source->schema->txn_do( >-- >2.35.1
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