From 6a4cf2e9b730a2307f2b8af4e620bbb666d4b8b8 Mon Sep 17 00:00:00 2001 From: "Robin H. Johnson" Date: Mon, 31 Oct 2011 01:06:16 -0700 Subject: [PATCH] Try to only export items with matching holding. --- marc_export_custom/marc_export_custom | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/marc_export_custom/marc_export_custom b/marc_export_custom/marc_export_custom index 847ead7..21679c2 100755 --- a/marc_export_custom/marc_export_custom +++ b/marc_export_custom/marc_export_custom @@ -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){ -- 2.3.6