Bug 40119: Merge should not leave empty 6XX subfield $2 (MARC 21)

Currently, when removing 040 $f from authority record with 008/11 =
'z' (MARC 21), merge function removes the content of $2 subfield in
linked 6XX fields, leaving the 6XX $2 subfield empty.  This is not
correct.  We should not have empty subfields in a MARC record.

Instead, the old content of the $2 subfield should be retained (if
auth 008/11 is still = 'z').

Test plan:
==========
1. Have an authority record with 008/11 = 'z' and 040 $f = 'whatever'.
2. Link the record to a bibliographic 6XX.
3. Edit the authority record, removing 040 $f.
4. Go to bibliographic record and in modal "MARC preview" from Normal
   view notice that 6XX $2 exists but is empty. This is wrong.
5. Apply the patch ; restart all.
6. Repeat p. 1.-4. Note that the content of 6XX $2 has not been
   removed.

Sponsored-by: Ignatianum University in Cracow
Signed-off-by: Roman Dolny <roman.dolny@jezuici.pl>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit bd43ebdc5e)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
This commit is contained in:
Janusz Kaczmarek 2025-06-11 14:14:25 +00:00 committed by Paul Derscheid
parent 036d940d54
commit ba31b8cc35
No known key found for this signature in database
GPG Key ID: C25F9FD44CED595B
1 changed files with 3 additions and 1 deletions

View File

@ -1750,7 +1750,9 @@ sub merge {
if ( defined $controlled_ind->{sub2} ) {
# Add or replace
$field_to->update( 2 => $controlled_ind->{sub2} );
if ( $controlled_ind->{sub2} ne q{} ) {
$field_to->update( 2 => $controlled_ind->{sub2} );
}
} else {
# Key alerts us here to remove $2