From a2920ac0e9ac26f75173129e3069359efc87f9aa Mon Sep 17 00:00:00 2001 From: Andrew Nugged Date: Sun, 28 Aug 2022 00:23:45 +0300 Subject: [PATCH] Bug 20447: (QA follow-up) Remove undef warnings and add UX note Use of uninitialized value in concatenation (.) or string at /usr/share/koha/lib/Koha/UI/Form/Builder/Item.pm line 255. Signed-off-by: Nick Clemens --- Koha/UI/Form/Builder/Item.pm | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/Koha/UI/Form/Builder/Item.pm b/Koha/UI/Form/Builder/Item.pm index 32b9d485f3..3458e8ee10 100644 --- a/Koha/UI/Form/Builder/Item.pm +++ b/Koha/UI/Form/Builder/Item.pm @@ -252,7 +252,23 @@ sub generate_subfield_form { my $holdings = Koha::Holdings->search({ biblionumber => $biblionumber, deleted_on => undef }, { order_by => ['holdingbranch'] }); while (my $holding = $holdings->next()) { push @authorised_values, $holding->holding_id; - $authorised_lib{$holding->holding_id} = $holding->holding_id . ' ' . $holding->holdingbranch . ' ' . $holding->location . ' ' . $holding->ccode . ' ' . $holding->callnumber; + + # Rare, but potentual UX issue: because all rendered in single string without + # delimters, in case of empty (or undef) $holding-> methods results below, user + # might be confused with "to which next value belongs", for example, one record has: + # holdingbranch = ‘MN’ + # location = undef + # and the other has: + # holdingbranch = '' + # location = ‘MN’ + # the user will get two selects for "MN" which will look the same, + # so the user won't be able to distinguisgh. + + $authorised_lib{$holding->holding_id} = $holding->holding_id + . ' ' . ($holding->holdingbranch // '') + . ' ' . ($holding->location // '') + . ' ' . ($holding->ccode // '') + . ' ' . ($holding->callnumber // ''); } my $input = CGI->new; $value = $input->param('holding_id') unless ($value); -- 2.37.2