From ad7a9355a34c8ca56de6388b12fe1b79ed44f126 Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Thu, 3 Jul 2025 13:55:09 +0100 Subject: [PATCH] Bug 37305: (follow-up) Only add control number subfield when defined The previous commit introduced a bug where the control number subfield 'w' was being added to the MARC field even when undefined, causing test failures. This patch adds a condition to only push the control number subfield when the value is actually defined, matching the pattern used for other subfields in the method. Signed-off-by: Martin Renvoize Signed-off-by: Lucas Gass (cherry picked from commit 32860c2778bcd39bf2b212829f3102037885814b) Signed-off-by: Paul Derscheid --- Koha/Biblio.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Koha/Biblio.pm b/Koha/Biblio.pm index 4f0c0bf1f9..45b9b27fc7 100644 --- a/Koha/Biblio.pm +++ b/Koha/Biblio.pm @@ -2013,7 +2013,7 @@ sub generate_marc_host_field { $w = '(' . $host_field->data() . ')' . $w; } - push @sfd, ( w => $w ); + push @sfd, ( w => $w ) if $w; } $link_field = MARC::Field->new( 773, '0', ' ', @sfd ); } elsif ( $marcflavour eq 'UNIMARC' ) {