From 12ddc08f94a52fc6924ec14c41966015a01004a5 Mon Sep 17 00:00:00 2001 From: Julian Maurice Date: Wed, 31 Mar 2021 10:44:48 +0200 Subject: [PATCH] Bug 24564: Do not modify the tab of existing subfield in ifla/update.pl Test plan: 1. Find a biblio subfield in misc/migration_tools/ifla/data/biblio/default.yml that you have in your default biblio MARC framework (or create one). 2. Change the tab of this subfield so that it's different from what's in the .yml file 3. Run misc/migration_tools/ifla/update.pl --force 4. Verify that the tab of this subfield has not been changed. 5. Do the same for authorities (files are in misc/migration_tools/ifla/data/auth/) Signed-off-by: sonia Signed-off-by: Victor Grousset/tuxayo Signed-off-by: Nick Clemens Signed-off-by: Jonathan Druart Signed-off-by: Jonathan Druart (cherry picked from commit 2f522d8ad4d0ce4a05250063bcc1dcba9fabd7ee) Signed-off-by: Fridolin Somers (cherry picked from commit 1440eb532d4bd2abdc76b4955cabb492283737a7) Signed-off-by: Andrew Fuerste-Henry (cherry picked from commit 6a89c2dd82f94ac5795c0e9b7abd6ce77733c902) Signed-off-by: Victor Grousset/tuxayo --- misc/migration_tools/ifla/update.pl | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/misc/migration_tools/ifla/update.pl b/misc/migration_tools/ifla/update.pl index b736bf88ad..aff4a39c3f 100755 --- a/misc/migration_tools/ifla/update.pl +++ b/misc/migration_tools/ifla/update.pl @@ -236,7 +236,12 @@ for my $subfield (@subfields) { say sprintf('Subfield already exists: %s$%s', $subfield->{tagfield}, $subfield->{tagsubfield}); if ($force) { say sprintf('Force mode is active, updating subfield %s$%s', $subfield->{tagfield}, $subfield->{tagsubfield}); - $mss->update($subfield); + + # Do not modify the tab of existing subfield + my %values = %$subfield; + delete $values{tab}; + + $mss->update(\%values); } next; } @@ -299,7 +304,12 @@ for my $authsubfield (@authsubfields) { say sprintf('Auth subfield already exists: %s$%s (%s)', $authsubfield->{tagfield}, $authsubfield->{tagsubfield}, $authsubfield->{authtypecode}); if ($force) { say sprintf('Force mode is active, updating auth subfield %s$%s (%s)', $authsubfield->{tagfield}, $authsubfield->{tagsubfield}, $authsubfield->{authtypecode}); - $ass->update($authsubfield); + + # Do not modify the tab of existing subfield + my %values = %$authsubfield; + delete $values{tab}; + + $ass->update(\%values); } next; } -- 2.39.5