From 28221e56593772bd6cf6348c9d3263b101e9767b Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Thu, 28 Oct 2021 10:43:05 +0200 Subject: [PATCH] Bug 27526: Fix SubfieldsToUseWhenPrefill my $a = "z"; my @x = split ( ' ', $a ) || (""); @x will be [1] Which is not at all what we are expecting here! Be more verbose and don't introduce bug. --- cataloguing/additem.pl | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cataloguing/additem.pl b/cataloguing/additem.pl index e1787ee49a4..c2eef2ba6fb 100755 --- a/cataloguing/additem.pl +++ b/cataloguing/additem.pl @@ -566,8 +566,9 @@ my $branchcode = $input->param('branch') || C4::Context->userenv->{branch}; # If the subfield must be prefilled with last catalogued item my @subfields_to_prefill; if ( $nextop eq 'additem' && $prefillitem ) { + @subfields_to_prefill = split(' ', C4::Context->preference('SubfieldsToUseWhenPrefill')); # Setting to 1 element if SubfieldsToUseWhenPrefill is empty to prevent all the subfields to be prefilled - @subfields_to_prefill = split(' ', C4::Context->preference('SubfieldsToUseWhenPrefill')) || (""); + @subfields_to_prefill = ("") unless @subfields_to_prefill; } # Getting list of subfields to keep when restricted editing is enabled -- 2.25.1