From 8245c0b001e0bfb6592d281991d8e0f07416e26b Mon Sep 17 00:00:00 2001 From: Janusz Kaczmarek Date: Wed, 11 Jun 2025 14:14:25 +0000 Subject: [PATCH] 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 --- C4/AuthoritiesMarc.pm | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/C4/AuthoritiesMarc.pm b/C4/AuthoritiesMarc.pm index ab62a5d962..4cbed9e95d 100644 --- a/C4/AuthoritiesMarc.pm +++ b/C4/AuthoritiesMarc.pm @@ -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 -- 2.39.5