From bcc9ae88fa440e9209d6764c2cc4b4ce57b3134e Mon Sep 17 00:00:00 2001 From: Mike Rylander Date: Mon, 9 May 2016 17:28:44 -0400 Subject: [PATCH] LP#1575908: Avoid removing $0s we do not understand Signed-off-by: Mike Rylander --- Open-ILS/src/support-scripts/authority_authority_linker.pl.in | 3 ++- Open-ILS/src/support-scripts/authority_control_fields.pl.in | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/Open-ILS/src/support-scripts/authority_authority_linker.pl.in b/Open-ILS/src/support-scripts/authority_authority_linker.pl.in index d9ba725718..7c1398f7c9 100755 --- a/Open-ILS/src/support-scripts/authority_authority_linker.pl.in +++ b/Open-ILS/src/support-scripts/authority_authority_linker.pl.in @@ -181,7 +181,8 @@ while (my ($src, $links) = $sth->fetchrow_array) { if ($target_string eq $src_string) { print "got a match ...\n" if $options{debug}; - $field->update('0' => "($cni)$target"); + $field->delete_subfield(code => '0', match => qr/^\([^)]+\)\d+/); + $field->add_subfields('0' => "($cni)$target"); } } } diff --git a/Open-ILS/src/support-scripts/authority_control_fields.pl.in b/Open-ILS/src/support-scripts/authority_control_fields.pl.in index 64d32f98f0..bf94cdf576 100755 --- a/Open-ILS/src/support-scripts/authority_control_fields.pl.in +++ b/Open-ILS/src/support-scripts/authority_control_fields.pl.in @@ -413,7 +413,7 @@ foreach my $rec_id (@records) { # print $_->as_formatted(); if ($refresh and defined(scalar($bib_field->subfield('0')))) { - $bib_field->delete_subfield(code => '0'); + $bib_field->delete_subfield(code => '0', match => qr/^\([^)]+\)\d+/); $changed = 1; } -- 2.11.0