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

svn at svn.open-ils.org svn at svn.open-ils.org
Mon Mar 2 21:38:10 EST 2009


Author: miker
Date: 2009-03-02 21:38:08 -0500 (Mon, 02 Mar 2009)
New Revision: 12366

Modified:
   trunk/Open-ILS/src/perlmods/OpenILS/Application/Ingest.pm
Log:
generate call number IDs for batch ingest, and give some breathing room

Modified: trunk/Open-ILS/src/perlmods/OpenILS/Application/Ingest.pm
===================================================================
--- trunk/Open-ILS/src/perlmods/OpenILS/Application/Ingest.pm	2009-03-03 02:19:02 UTC (rev 12365)
+++ trunk/Open-ILS/src/perlmods/OpenILS/Application/Ingest.pm	2009-03-03 02:38:08 UTC (rev 12366)
@@ -162,6 +162,7 @@
             if ($new_cns_by_owner{$owner}) {
                 $u->{call_number} = $new_cns_by_owner{$owner};
             } else {
+                $u->{call_number}->clear_id;
     	        $u->{call_number} = $new_cns_by_owner{$owner} = $cstore->request(
                     'open-ils.cstore.direct.asset.call_number.create' => $u->{call_number}
                 )->gather(1);
@@ -399,9 +400,12 @@
 	my $bib = shift;
 	my $xml = OpenILS::Application::Ingest::entityize($bib->marc);
 
+	my $cn = $cstore->request( 'open-ils.cstore.direct.asset.call_number.search' => { id => { '!=' => undef }, { limit => 1 } } )->gather(1);
+    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);
+	my @uris = $self->method_lookup("open-ils.ingest.856_uri.object")->run($bib, $max_cn);
 	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);
@@ -1089,6 +1093,7 @@
 
     my $recid   = shift;
 	my $marcxml = shift;
+	my $max_cn = shift;
 	my @objects;
 	
 	my $document = $parser->parse_string($marcxml);
@@ -1148,6 +1153,7 @@
         if (!$cn) {
             $cn = Fieldmapper::asset::call_number->new;
             $cn->isnew( 1 );
+            $cn->id( $$max_cn++ );
             $cn->owning_lib( $org->id );
             $cn->record( $recid );
             $cn->label( '##URI##' );
@@ -1188,10 +1194,11 @@
 	my $self = shift;
 	my $client = shift;
 	my $obj = shift;
+	my $max_cn = shift;
 
 	return undef unless ($obj and $obj->marc);
 
-	$client->respond($_) for (_extract_856_uris($obj->id, $obj->marc));
+	$client->respond($_) for (_extract_856_uris($obj->id, $obj->marc, \$max_cn));
 	return undef;
 }
 __PACKAGE__->register_method(  



More information about the open-ils-commits mailing list