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 <martin.renvoize@openfifth.co.uk>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit 32860c2778)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
This commit is contained in:
Martin Renvoize 2025-07-03 13:55:09 +01:00 committed by Paul Derscheid
parent a5949e7575
commit ad7a9355a3
No known key found for this signature in database
GPG Key ID: C25F9FD44CED595B
1 changed files with 1 additions and 1 deletions

View File

@ -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' ) {