vandelay copy overlay; perl cleanup
authorBill Erickson <berick@esilibrary.com>
Mon, 30 Jul 2012 02:10:18 +0000 (22:10 -0400)
committerBill Erickson <berick@esilibrary.com>
Mon, 30 Jul 2012 02:10:18 +0000 (22:10 -0400)
Signed-off-by: Bill Erickson <berick@esilibrary.com>
Open-ILS/src/perlmods/lib/OpenILS/Application/Vandelay.pm

index b5a6b28..6ca4b6b 100644 (file)
@@ -1609,7 +1609,7 @@ sub import_record_asset_list_impl {
                 $copy = $e->search_asset_copy([
                     {id => $copy_id, deleted => 'f'},
                     {flesh => 1, flesh_fields => {acp => ['call_number']}}
-                ]);
+                ])->[0];
 
                 if (!$copy) {
                     $$report_args{evt} = $e->die_event;
@@ -1618,8 +1618,8 @@ sub import_record_asset_list_impl {
                 }
 
                 # prevent update of unrelated copies
-                if ($copy->call_number->record != $rec_id) {
-                    $logger->info("vl: attempt to overlay unrelated copy=$copy_id; rec=$rec_id");
+                if ($copy->call_number->record != $rec->imported_as) {
+                    $logger->info("vl: attempt to overlay unrelated copy=$copy_id; rec=".$rec->imported_as);
 
                     $evt = OpenILS::Event->new('INVALID_IMPORT_COPY_ID', 
                         note => 'Cannot overlay copies for unlinked bib',
@@ -1705,6 +1705,7 @@ sub import_record_asset_list_impl {
 
                 # de-flesh for update
                 $copy->call_number($copy->call_number->id);
+                $copy->ischanged(1);
 
                 $evt = OpenILS::Application::Cat::AssetCommon->
                     update_fleshed_copies($e, {all => 1}, undef, [$copy]);
@@ -1805,7 +1806,6 @@ sub import_record_asset_list_impl {
             respond_with_status($report_args);
             $logger->info("vl: successfully imported item " . $item->barcode);
         }
-
     }
 
     $roe->rollback;