[open-ils-commits] r11167 - trunk/Open-ILS/src/perlmods/OpenILS/Application/Cat

svn at svn.open-ils.org svn at svn.open-ils.org
Thu Nov 13 14:49:22 EST 2008


Author: miker
Date: 2008-11-13 14:49:18 -0500 (Thu, 13 Nov 2008)
New Revision: 11167

Modified:
   trunk/Open-ILS/src/perlmods/OpenILS/Application/Cat/BibCommon.pm
Log:
finally moving to tag 901 for local identifier stuff

Modified: trunk/Open-ILS/src/perlmods/OpenILS/Application/Cat/BibCommon.pm
===================================================================
--- trunk/Open-ILS/src/perlmods/OpenILS/Application/Cat/BibCommon.pm	2008-11-13 19:19:21 UTC (rev 11166)
+++ trunk/Open-ILS/src/perlmods/OpenILS/Application/Cat/BibCommon.pm	2008-11-13 19:49:18 UTC (rev 11167)
@@ -191,17 +191,27 @@
 	my $editor = shift;
 	my $existing_rec = shift;
 
-	my $add_039 = 0;
+	my $add_901 = 0;
 
-	my $xpath = '//marc:datafield[@tag="039"]/marc:subfield[@code="a"]';
+	my $xpath = '//marc:datafield[@tag="901"]/marc:subfield[@code="a"]';
 	my ($tcn) = $marcxml->documentElement->findvalue($xpath) =~ /(\w+)\s*$/o;
-	$xpath = '//marc:datafield[@tag="039"]/marc:subfield[@code="b"]';
-	my $tcn_source = $marcxml->documentElement->findvalue($xpath) || "System Local";
 
+    if (!$tcn) {
+	    $xpath = '//marc:datafield[@tag="039"]/marc:subfield[@code="a"]';
+	    ($tcn) = $marcxml->documentElement->findvalue($xpath) =~ /(\w+)\s*$/o;
+    }
+
+	$xpath = '//marc:datafield[@tag="901"]/marc:subfield[@code="b"]';
+	my ($tcn_source) = $marcxml->documentElement->findvalue($xpath);
+    if (!$tcn_source) {
+	    $xpath = '//marc:datafield[@tag="039"]/marc:subfield[@code="b"]';
+    	$tcn_source = $marcxml->documentElement->findvalue($xpath) || "System Local";
+    }
+
 	if(_tcn_exists($editor, $tcn, $tcn_source, $existing_rec)) {
 		$tcn = undef;
 	} else {
-		$add_039++;
+		$add_901++;
 	}
 
 
@@ -241,9 +251,9 @@
 
 	return undef unless $tcn;
 
-	if ($add_039) {
+	if ($add_901) {
 		my $df = $marcxml->createElementNS( 'http://www.loc.gov/MARC21/slim', 'datafield');
-		$df->setAttribute( tag => '039' );
+		$df->setAttribute( tag => '901' );
 		$df->setAttribute( ind1 => ' ' );
 		$df->setAttribute( ind2 => ' ' );
 		$marcxml->documentElement->appendChild( $df );
@@ -257,6 +267,13 @@
 		$sfb->setAttribute( code => 'b' );
 		$sfb->appendChild( $marcxml->createTextNode( $tcn_source ) );
 		$df->appendChild( $sfb );
+
+        if ($existing_rec) {
+    		my $sfc = $marcxml->createElementNS( 'http://www.loc.gov/MARC21/slim', 'subfield');
+    		$sfc->setAttribute( code => 'c' );
+	    	$sfc->appendChild( $marcxml->createTextNode( $existing_rec ) );
+		    $df->appendChild( $sfb );
+        }
 	}
 
 	return $tcn;



More information about the open-ils-commits mailing list