[open-ils-commits] r15859 - branches/rel_1_6/Open-ILS/src/perlmods/OpenILS/Application/Cat (miker)

svn at svn.open-ils.org svn at svn.open-ils.org
Tue Mar 16 10:17:18 EDT 2010


Author: miker
Date: 2010-03-16 10:17:16 -0400 (Tue, 16 Mar 2010)
New Revision: 15859

Modified:
   branches/rel_1_6/Open-ILS/src/perlmods/OpenILS/Application/Cat/BibCommon.pm
Log:
Patch from Galen Charlton: removes empty controlfield elements, which can be produced in a couple different ways during the ingest of slightly invalid MARC records

Modified: branches/rel_1_6/Open-ILS/src/perlmods/OpenILS/Application/Cat/BibCommon.pm
===================================================================
--- branches/rel_1_6/Open-ILS/src/perlmods/OpenILS/Application/Cat/BibCommon.pm	2010-03-16 14:16:52 UTC (rev 15858)
+++ branches/rel_1_6/Open-ILS/src/perlmods/OpenILS/Application/Cat/BibCommon.pm	2010-03-16 14:17:16 UTC (rev 15859)
@@ -111,6 +111,11 @@
 	my $marcxml = XML::LibXML->new->parse_string($xml);
 	$marcxml->documentElement->setNamespace($MARC_NAMESPACE, "marc", 1 );
 	$marcxml->documentElement->setNamespace($MARC_NAMESPACE);
+	# remove empty control fields - at least one source of records adds ersatz blank 008s
+	# that become empty controlfield elements
+	foreach my $controlfield ($marcxml->documentElement->getElementsByTagNameNS($MARC_NAMESPACE, 'controlfield')) {
+		$controlfield->parentNode->removeChild($controlfield) unless $controlfield->hasChildNodes();
+	}
 	return $marcxml;
 }
 



More information about the open-ils-commits mailing list