From: Dan Scott Date: Sun, 18 Jan 2015 17:20:36 +0000 (-0500) Subject: Add 020 cleanup to springer fixes while we're at it X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=b50730fd419e86045583f293a0b06927ecb0b724;p=contrib%2FConifer.git Add 020 cleanup to springer fixes while we're at it Signed-off-by: Dan Scott --- diff --git a/Open-ILS/src/sql/Pg/fix_old_springer.sql b/Open-ILS/src/sql/Pg/fix_old_springer.sql index cef309fdc9..42a2f44ae3 100644 --- a/Open-ILS/src/sql/Pg/fix_old_springer.sql +++ b/Open-ILS/src/sql/Pg/fix_old_springer.sql @@ -29,6 +29,21 @@ foreach my $fate (@fates) { $fate->update($data); } +# Cleanup ISBNs that had silly leading spaces prepended +my @isbntags = $record->field('020'); +foreach my $isbntag (@isbntags) { + my $rawisbn = $isbntag->subfield('a'); + next unless $rawisbn; + $rawisbn =~ s{^\s*(\S+)\s*$}{$1}; + my ($isbn, $rest) = split(/ /, $rawisbn, 2); + if ($rawisbn ne $isbn) { + $isbntag->update('a', $isbn); + } + if ($rest and $isbntag->subfield('q') ne $rest) { + $isbntag->update('q', $rest); + } +} + # Add explicit publisher relator code my @added = $record->field('710'); foreach my $entry (@added) {