From 6002ddabf94232759e88d9ac45c165a9ca4459cb 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 --- 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 cca30f0a09..3d4be0a624 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.11.0