Bug 29883: avoid uninitialized value warn in GetAuthorisedValues sub

GetAuthorisedValues is defined with optional parameter $category but it
is instantly interpolated without preventing "Use of uninitialized value
$category in concatenation (.) or string at .../C4/Koha.pm line 491."
warning.
As category param is optional, we can avoid throwing that warn as it is
something that can happen and is not an actual error:
C<$category> returns authorized values for just one category (optional).

Signed-off-by: David Nind <david@davidnind.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
This commit is contained in:
Petro Vashchuk 2022-01-14 11:57:39 +02:00 committed by Tomas Cohen Arazi
parent 3b431117e4
commit 44e126bcc7
No known key found for this signature in database
GPG Key ID: 0A272EA1B2F3C15F
1 changed files with 2 additions and 2 deletions

View File

@ -482,10 +482,10 @@ C<$opac> If set to a true value, displays OPAC descriptions rather than normal o
=cut
sub GetAuthorisedValues {
my ( $category, $opac ) = @_;
my $category = shift // ''; # optional parameter
my $opac = shift ? 1 : 0; # normalise to be safe
# Is this cached already?
$opac = $opac ? 1 : 0; # normalise to be safe
my $branch_limit =
C4::Context->userenv ? C4::Context->userenv->{"branch"} : "";
my $cache_key =