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

svn at svn.open-ils.org svn at svn.open-ils.org
Wed Sep 3 22:43:31 EDT 2008


Author: erickson
Date: 2008-09-03 22:43:30 -0400 (Wed, 03 Sep 2008)
New Revision: 10529

Modified:
   trunk/Open-ILS/src/perlmods/OpenILS/Application/Vandelay.pm
Log:
added an overlay version of the queued bib import

Modified: trunk/Open-ILS/src/perlmods/OpenILS/Application/Vandelay.pm
===================================================================
--- trunk/Open-ILS/src/perlmods/OpenILS/Application/Vandelay.pm	2008-09-03 21:37:08 UTC (rev 10528)
+++ trunk/Open-ILS/src/perlmods/OpenILS/Application/Vandelay.pm	2008-09-04 02:43:30 UTC (rev 10529)
@@ -366,19 +366,42 @@
 	record_type	=> 'auth'
 );
 
+__PACKAGE__->register_method(  
+	api_name	=> "open-ils.vandelay.bib_record.list.overlay",
+	method		=> 'import_record_list',
+	api_level	=> 1,
+	argc		=> 2,
+    stream      => 1,
+	record_type	=> 'bib'
+);
+
+__PACKAGE__->register_method(  
+	api_name	=> "open-ils.vandelay.auth_record.list.overlay",
+	method		=> 'import_record_list',
+	api_level	=> 1,
+	argc		=> 2,
+    stream      => 1,
+	record_type	=> 'auth'
+);
+
+
 sub import_record_list {
-    my($self, $conn, $auth, $rec_ids) = @_;
+    my($self, $conn, $auth, $rec_ids, $args) = @_;
     my $e = new_editor(xact => 1, authtoken => $auth);
     return $e->die_event unless $e->checkauth;
-    my $err = import_record_list_impl($self, $conn, $auth, $e, $rec_ids);
+    $args ||= {};
+    my $err = import_record_list_impl($self, $conn, $auth, $e, $rec_ids, $args);
     return $err if $err;
     $e->commit;
     return {complete => 1};
 }
 
+#open-ils.cat.biblio.record.xml.update
+
 sub import_record_list_impl {
-    my($self, $conn, $auth, $e, $rec_ids) = @_;
+    my($self, $conn, $auth, $e, $rec_ids, $args) = @_;
 
+    my $overlay_map = $args->{overlay_map};
     my $type = $self->{record_type};
     my $total = @$rec_ids;
     my $count = 0;
@@ -389,10 +412,18 @@
             my $rec = $e->retrieve_vandelay_queued_bib_record($rec_id) 
                 or return $e->die_event;
 
-            my $record = $U->simplereq(
-                'open-ils.cat',
-                'open-ils.cat.biblio.record.xml.import',
-                $auth, $rec->marc ); #$rec->bib_source);
+            my $record;
+            if($self->api_name =~ /overlay/) {
+                $record = $U->simplereq(
+                    'open-ils.cat',
+                    'open-ils.cat.biblio.record.xml.update',
+                    $auth, $overlay_map->{$rec_id}, $rec->marc); #$rec->bib_source);
+            } else {
+                $record = $U->simplereq(
+                    'open-ils.cat',
+                    'open-ils.cat.biblio.record.xml.import',
+                    $auth, $rec->marc); #$rec->bib_source);
+            }
 
             if($U->event_code($record)) {
                 $e->rollback;



More information about the open-ils-commits mailing list