$$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']}}
]);