removing leading and trailing spaces when extracting TCN from 001 user/gmcharlt/norm_tcn_value_from_001
authorGalen Charlton <gmc@esilibrary.com>
Fri, 13 Jan 2012 22:13:00 +0000 (17:13 -0500)
committerGalen Charlton <gmc@esilibrary.com>
Fri, 13 Jan 2012 22:13:00 +0000 (17:13 -0500)
Now that the MARC editor is less likely to strip whitespace by
accident, make sure that TCN values extracted from the 001 field
have leading and trailing whitespace removed.  This particularly
affects OCLC records, since a record downloaded from OCLC with an
eight-digit OCLC number will have a trailing space in the 001.

This makes TCNs match the normalization expected by TCN searches.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Open-ILS/src/perlmods/lib/OpenILS/Application/Cat/BibCommon.pm

index 6a776d8..8d6ff48 100644 (file)
@@ -176,6 +176,7 @@ sub _find_tcn_info {
 
        my $xpath = '//marc:controlfield[@tag="001"]';
        my $tcn = $marcxml->documentElement->findvalue($xpath);
+       $tcn =~ s/^\s+|\s+$//og;
        $logger->info("biblio import located 001 (tcn) value of $tcn");
 
        $xpath = '//marc:controlfield[@tag="003"]';