insert_856_9: more accurate detection of incumbent subfield-9 data
authorBen Ostrowsky <ben@esilibrary.com>
Fri, 9 Sep 2011 19:16:39 +0000 (19:16 +0000)
committerGalen Charlton <gmc@esilibrary.com>
Mon, 16 Jul 2012 15:32:45 +0000 (11:32 -0400)
sql/base/base.sql

index 8bcff20..d9c9e12 100644 (file)
@@ -1079,7 +1079,7 @@ CREATE OR REPLACE FUNCTION migration_tools.insert_856_9 (TEXT, TEXT) RETURNS TEX
 
     foreach my $field ( $marc->field('856') ) {
       if ( scalar(grep( /(netlibrary|overdrive)\.com/i, $field->subfield('u'))) > 0 &&
-           scalar(grep( $shortname, $field->subfield('9'))) == 0 ) {
+           ! ( $field->as_string('9') =~ m/$shortname/ ) ) {
         $field->add_subfields( '9' => $shortname );
                                $field->update( ind2 => '0');
       }