if (my $copy_id = $item->internal_id) { # assignment
# copy matches an existing copy. Overlay instead of create.
+ $logger->info("vl: performing copy overlay for internal_id=$copy_id");
+
my $qt = $e->json_query({
select => {vbq => ['queue_type']},
from => {vqbr => 'vbq'},
next;
}
$copy_id = $lid->eg_copy_id;
+ $logger->info("vl: performing ACQ copy overlay for copy $copy_id");
}
$copy = $e->search_asset_copy([
}
# prevent update of unrelated copies
- if ($copy->call_number->record != $rec->imported_as) {
+ if ($copy->call_number->record != $rec_id) {
+ $logger->info("vl: attempt to overlay unrelated copy=$copy_id; rec=$rec_id");
+
$evt = OpenILS::Event->new('INVALID_IMPORT_COPY_ID',
note => 'Cannot overlay copies for unlinked bib',
bre => $rec->imported_as,
})->[0]->{count};
if ($count == 1) {
-
# if this is the only copy attached to this
# callnumber, just update the callnumber
+ $logger->info("vl: updating callnumber label in copy overlay");
+
$copy->call_number->label($item->call_number);
if (!$e->udpate_asset_call_number($copy->call_number)) {
$$report_args{evt} = $e->die_event;
# note that overlay does not allow the owning_lib
# to be changed. Should it?
+ $logger->info("vl: moving copy to new callnumber in copy overlay");
+
($vol, $evt) =
OpenILS::Application::Cat::AssetCommon->find_or_create_volume(
$e, $item->call_number,
}
} # cn-update
- # for any field that has a defined value, replace the value on the copy
- $copy->barcode($item->barcode) if defined $item->barcode;
- $copy->location($item->location) if defined $item->location;
- $copy->circ_lib($item->circ_lib) if defined $item->circ_lib;
- $copy->status($item->status) if defined $item->status;
- $copy->circulate($item->circulate) if defined $item->circulate;
- $copy->deposit($item->deposit) if $item->deposit;
- $copy->deposit_amount($item->deposit_amount) if defined $item->deposit_amount;
- $copy->ref($item->ref) if defined $item->ref;
- $copy->holdable($item->holdable) if defined $item->holdable;
- $copy->price($item->price) if defined $item->price;
- $copy->circ_as_type($item->circ_as_type) if defined $item->circ_as_type;
- $copy->alert_message($item->alert_message) if defined $item->alert_message;
- $copy->opac_visible($item->opac_visible) if defined $item->opac_visible;
- $copy->circ_modifier($item->circ_modifier) if defined $item->circ_modifier;
+ # for every field that has a non-'' value, overlay the copy value
+ foreach (qw/ barcode location circ_lib status
+ circulate deposit deposit_amount ref holdable
+ price circ_as_type alert_message opac_visible circ_modifier/) {
+
+ my $val = $item->$_();
+ $copy->$_($val) if $val and $val ne '';
+ }
# de-flesh for update
$copy->call_number($copy->call_number->id);
} else {
# Creating a new copy
+ $logger->info("vl: creating new copy in import");
# --------------------------------------------------------------------------------
# Find or create the volume