Try to only export items with matching holding.
authorRobin H. Johnson <rjohnson@sitka.bclibraries.ca>
Mon, 31 Oct 2011 08:06:16 +0000 (01:06 -0700)
committerRobin H. Johnson <rjohnson@sitka.bclibraries.ca>
Mon, 31 Oct 2011 08:06:16 +0000 (01:06 -0700)
marc_export_custom/marc_export_custom

index 847ead7..21679c2 100755 (executable)
@@ -241,7 +241,16 @@ sub export_record {
 
         my $r = MARC::Record->new_from_xml( $bib->marc, $encoding, $format );
         if ($type eq 'biblio') {
+            # Remove old 852 fields
+            my @f = $r->field('852');
+            $r->delete_fields(@f) if defined @f;
+            undef @f;
+            # Add new 852 fields 
             add_bib_holdings($bib, $r);
+            # Check that at least one 852 was added
+            my @f = $r->field('852');
+            # If not, we should NOT add this item to the export 
+            return unless defined @f;
         }
 
         if($force901){