From 7a4b979db1369ed8743963b9b9a9c87411fef2ed Mon Sep 17 00:00:00 2001 From: Andrew Nugged Date: Mon, 29 Nov 2021 12:07:36 +0200 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. --- 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 c9b97087ba..ee147472a1 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.30.1 (Apple Git-130)