Bug 40277 - Warn in C4::Koha::GetAuthorisedValues()
Summary: Warn in C4::Koha::GetAuthorisedValues()
Status: Needs Signoff
Alias: None
Product: Koha
Classification: Unclassified
Component: Architecture, internals, and plumbing (show other bugs)
Version: Main
Hardware: All All
: P5 - low minor
Assignee: Fridolin Somers
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks: 25790
  Show dependency treegraph
 
Reported: 2025-06-30 15:00 UTC by Fridolin Somers
Modified: 2025-06-30 15:19 UTC (History)
0 users

See Also:
GIT URL:
Change sponsored?: ---
Patch complexity: Trivial patch
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:


Attachments
Bug 40277: Remove warn in C4::Koha::GetAuthorisedValues() (1.51 KB, patch)
2025-06-30 15:18 UTC, Fridolin Somers
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Fridolin Somers 2025-06-30 15:00:39 UTC
When using not logged in OPAC, we see warns :
Use of uninitialized value $branch_limit in concatenation (.) or string

It comes from C4::Koha::GetAuthorisedValues() :
     my $branch_limit = C4::Context->userenv ? C4::Context->userenv->{"branch"} : "";
     my $cache_key    = "AuthorisedValues-$category-$opac-$branch_limit";

C4::Context->userenv->{"branch"} can be undef
Comment 1 Fridolin Somers 2025-06-30 15:18:58 UTC
Created attachment 183644 [details] [review]
Bug 40277: Remove warn in C4::Koha::GetAuthorisedValues()

When using not logged in OPAC, we see warns :
Use of uninitialized value $branch_limit in concatenation (.) or string

It comes from C4::Koha::GetAuthorisedValues() :
     my $branch_limit = C4::Context->userenv ? C4::Context->userenv->{"branch"} : "";
     my $cache_key    = "AuthorisedValues-$category-$opac-$branch_limit";

C4::Context->userenv->{"branch"} can be undef

Patch fixes wy using C4::Context::mybranch()

Test plan:
1.1) Without patch
1.2) Go to OPAC without logging in, open some pages
1.3) Check you have the warning in logs
2.1) Apply patch
2.2) Go to OPAC without logging in, open some pages
2.3) Check you don't have the warning in logs
Comment 2 Fridolin Somers 2025-06-30 15:19:54 UTC
Ah I can get this warn on KTD.
Looks like it is when changing language.