[open-ils-commits] r12371 - trunk/Open-ILS/src/perlmods/OpenILS/Application (miker)

svn at svn.open-ils.org svn at svn.open-ils.org
Mon Mar 2 23:58:15 EST 2009


Author: miker
Date: 2009-03-02 23:58:13 -0500 (Mon, 02 Mar 2009)
New Revision: 12371

Modified:
   trunk/Open-ILS/src/perlmods/OpenILS/Application/Ingest.pm
Log:
pass max_uri as well as max_cn

Modified: trunk/Open-ILS/src/perlmods/OpenILS/Application/Ingest.pm
===================================================================
--- trunk/Open-ILS/src/perlmods/OpenILS/Application/Ingest.pm	2009-03-03 04:19:41 UTC (rev 12370)
+++ trunk/Open-ILS/src/perlmods/OpenILS/Application/Ingest.pm	2009-03-03 04:58:13 UTC (rev 12371)
@@ -399,16 +399,26 @@
 	my $client = shift;
 	my $bib = shift;
 	my $xml = OpenILS::Application::Ingest::entityize($bib->marc);
+    my $max_cn = shift;
+    my $max_uri = shift;
 
 	my $cstore = OpenSRF::AppSession->connect( 'open-ils.cstore' );
-	my $cn = $cstore->request( 'open-ils.cstore.direct.asset.call_number.search' => { id => { '!=' => undef } }, { limit => 1, order_by => { acn => 'id desc' } } )->gather(1);
+
+    if (!$max_cn) {
+    	my $cn = $cstore->request( 'open-ils.cstore.direct.asset.call_number.search' => { id => { '!=' => undef } }, { limit => 1, order_by => { acn => 'id desc' } } )->gather(1);
+        $max_cn = int($cn->id) + 1000;
+    }
+
+    if (!$max_uri) {
+    	my $cn = $cstore->request( 'open-ils.cstore.direct.asset.call_number.search' => { id => { '!=' => undef } }, { limit => 1, order_by => { acn => 'id desc' } } )->gather(1);
+        $max_uri = int($cn->id) + 1000;
+    }
+
     $cstore->disconnect;
 
-    my $max_cn = int($cn->id) + 1000;
-
 	my $document = $parser->parse_string($xml);
 
-	my @uris = $self->method_lookup("open-ils.ingest.856_uri.object")->run($bib, $max_cn);
+	my @uris = $self->method_lookup("open-ils.ingest.856_uri.object")->run($bib, $max_cn, $max_uri);
 	my @mfr = $self->method_lookup("open-ils.ingest.flat_marc.biblio.xml")->run($document);
 	my @mXfe = $self->method_lookup("open-ils.ingest.extract.field_entry.all.xml")->run($document);
 	my ($fp) = $self->method_lookup("open-ils.ingest.fingerprint.xml")->run($xml);
@@ -1097,6 +1107,7 @@
     my $recid   = shift;
 	my $marcxml = shift;
 	my $max_cn = shift;
+	my $max_uri = shift;
 	my @objects;
 	
 	my $document = $parser->parse_string($marcxml);
@@ -1143,6 +1154,7 @@
         if (!$uri) {
             $uri = Fieldmapper::asset::uri->new;
             $uri->isnew( 1 );
+            $uri->id( $$max_uri++ );
             $uri->label($label);
             $uri->href($href);
             $uri->use_restriction($use);
@@ -1198,10 +1210,11 @@
 	my $client = shift;
 	my $obj = shift;
 	my $max_cn = shift;
+	my $max_uri = shift;
 
 	return undef unless ($obj and $obj->marc);
 
-	$client->respond($_) for (_extract_856_uris($obj->id, $obj->marc, \$max_cn));
+	$client->respond($_) for (_extract_856_uris($obj->id, $obj->marc, \$max_cn, \$max_uri));
 	return undef;
 }
 __PACKAGE__->register_method(  



More information about the open-ils-commits mailing list