From 50f746868c174ebc401a097cd2251d6594063ebd Mon Sep 17 00:00:00 2001 From: Bill Erickson Date: Fri, 27 Jul 2012 15:55:13 -0400 Subject: [PATCH] vandelay copy overlay cont. Signed-off-by: Bill Erickson --- .../perlmods/lib/OpenILS/Application/Vandelay.pm | 23 ++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Vandelay.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Vandelay.pm index 484a7e22c6..139e147df9 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Vandelay.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Vandelay.pm @@ -1581,11 +1581,30 @@ sub import_record_asset_list_impl { $$report_args{import_error} = undef; $$report_args{evt} = undef; - if ($item->internal_id) { + if (my $copy_id = $item->internal_id) { # assignment # copy matches an existing copy. Overlay instead of create. + my $qt = $e->json_query({ + select => {vbq => ['queue_type']}, + from => {vqbr => 'vbq'}, + where => {'+vqbr' => {id => $rec_id}} + })->[0]->{queue_type}; + + if ($qt eq 'acq') { + # internal_id for ACQ queues refers to acq.lineitem_detail.id + # pull the real copy id from the acq LID + + my $lid = $e->retrieve_acq_lineitem_detail($copy_id); + if (!$lid) { + $$report_args{evt} = $e->die_event; + respond_with_status($report_args); + next; + } + $copy_id = $lid->eg_copy_id; + } + $copy = $e->search_asset_copy([ - {id => $item->internal_id, deleted => 'f'}, + {id => $copy_id, deleted => 'f'}, {flesh => 1, flesh_fields => {acp => ['call_number']}} ]); -- 2.11.0