From 1440eb532d4bd2abdc76b4955cabb492283737a7 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 --- 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 6f84cdc74b..f8638c2bf7 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.20.1