[open-ils-commits] r18098 - branches/rel_2_0/Open-ILS/src/perlmods/OpenILS/Application (miker)
svn at svn.open-ils.org
svn at svn.open-ils.org
Wed Sep 29 10:46:27 EDT 2010
Author: miker
Date: 2010-09-29 10:46:25 -0400 (Wed, 29 Sep 2010)
New Revision: 18098
Modified:
branches/rel_2_0/Open-ILS/src/perlmods/OpenILS/Application/Vandelay.pm
Log:
Backport r18097 from trunk: Process item imports during record import, not as a secondary call (never should have worked, but for transaction timing)
Modified: branches/rel_2_0/Open-ILS/src/perlmods/OpenILS/Application/Vandelay.pm
===================================================================
--- branches/rel_2_0/Open-ILS/src/perlmods/OpenILS/Application/Vandelay.pm 2010-09-29 14:45:50 UTC (rev 18097)
+++ branches/rel_2_0/Open-ILS/src/perlmods/OpenILS/Application/Vandelay.pm 2010-09-29 14:46:25 UTC (rev 18098)
@@ -641,6 +641,7 @@
$rec_class = 'vqar';
}
+ my @success_rec_ids;
for my $rec_id (@$rec_ids) {
my $overlay_target = $overlay_map->{$rec_id};
@@ -766,6 +767,7 @@
}
if($imported) {
+ push @success_rec_ids, $rec_id;
$e->commit;
} else {
# Send an update whenever there's an error
@@ -795,6 +797,8 @@
$e->rollback;
}
+ import_record_asset_list_impl($conn, \@success_rec_ids, $requestor);
+
$conn->respond({total => $total, progress => $count});
return undef;
}
@@ -961,7 +965,7 @@
__PACKAGE__->register_method(
api_name => "open-ils.vandelay.bib_record.list.asset.import",
- method => 'import_record_list_assets',
+ method => 'noop_import_items',
api_level => 1,
argc => 2,
stream => 1,
@@ -969,40 +973,42 @@
);
__PACKAGE__->register_method(
api_name => "open-ils.vandelay.bib_record.queue.asset.import",
- method => 'import_record_queue_assets',
+ method => 'noop_import_items',
api_level => 1,
argc => 2,
stream => 1,
record_type => 'bib'
);
-sub import_record_list_assets {
- my($self, $conn, $auth, $import_def, $rec_ids) = @_;
- my $e = new_editor(xact=>1, authtoken => $auth);
- return $e->die_event unless $e->checkauth;
- my $err = import_record_asset_list_impl($conn, $import_def, $rec_ids, $e->requestor);
- $e->rollback;
- return $err if $err;
- return {complete => 1};
-}
+sub noop_import_items { return {complete => 1} }
-sub import_record_queue_assets {
- my($self, $conn, $auth, $import_def, $q_id) = @_;
- my $e = new_editor(xact=>1, authtoken => $auth);
- return $e->die_event unless $e->checkauth;
- my $rec_ids = $e->search_vandelay_queued_bib_record(
- {queue => $q_id, import_time => {'!=' => undef}}, {idlist => 1});
- my $err = import_record_asset_list_impl($conn, $import_def, $rec_ids, $e->requestor);
- $e->rollback;
- return $err if $err;
- return {complete => 1};
-}
+#sub import_record_list_assets {
+# my($self, $conn, $auth, $import_def, $rec_ids) = @_;
+# my $e = new_editor(xact=>1, authtoken => $auth);
+# return $e->die_event unless $e->checkauth;
+# my $err = import_record_asset_list_impl($conn, $import_def, $rec_ids, $e->requestor);
+# $e->rollback;
+# return $err if $err;
+# return {complete => 1};
+#}
+#
+#sub import_record_queue_assets {
+# my($self, $conn, $auth, $import_def, $q_id) = @_;
+# my $e = new_editor(xact=>1, authtoken => $auth);
+# return $e->die_event unless $e->checkauth;
+# my $rec_ids = $e->search_vandelay_queued_bib_record(
+# {queue => $q_id, import_time => {'!=' => undef}}, {idlist => 1});
+# my $err = import_record_asset_list_impl($conn, $import_def, $rec_ids, $e->requestor);
+# $e->rollback;
+# return $err if $err;
+# return {complete => 1};
+#}
# --------------------------------------------------------------------------------
# Given a list of queued record IDs, imports all items attached to those records
# --------------------------------------------------------------------------------
sub import_record_asset_list_impl {
- my($conn, $import_def, $rec_ids, $requestor) = @_;
+ my($conn, $rec_ids, $requestor) = @_;
my $total = @$rec_ids;
my $try_count = 0;
@@ -1012,7 +1018,7 @@
for my $rec_id (@$rec_ids) {
my $rec = $roe->retrieve_vandelay_queued_bib_record($rec_id);
next unless $rec and $rec->import_time;
- my $item_ids = $roe->search_vandelay_import_item({definition => $import_def, record => $rec->id}, {idlist=>1});
+ my $item_ids = $roe->search_vandelay_import_item({record => $rec->id}, {idlist=>1});
for my $item_id (@$item_ids) {
my $e = new_editor(requestor => $requestor, xact => 1);
More information about the open-ils-commits
mailing list