LP#1619703 Transfer ACQ lineitem to alternate bib WIP
authorBill Erickson <berickxx@gmail.com>
Thu, 13 Oct 2016 17:42:10 +0000 (13:42 -0400)
committerBill Erickson <berickxx@gmail.com>
Fri, 17 Mar 2017 14:57:22 +0000 (10:57 -0400)
Signed-off-by: Bill Erickson <berickxx@gmail.com>
Open-ILS/src/perlmods/lib/OpenILS/Application/Acq/Order.pm

index 622d1e0..b157a1d 100644 (file)
@@ -4269,7 +4269,7 @@ sub transfer_order_volume {
         }]},
         from => 'acp',
         where => {call_number => $cn_id}
-    });
+    })->[0];
 
     my $target_cn;
     my $evt;
@@ -4289,10 +4289,14 @@ sub transfer_order_volume {
             # We are transferring all attached copies to the matching
             # callnumber on the target bib.  This call number is no 
             # longer needed.  Delete it.
-            $cn->deleted('t');
-            $cn->edit_date('now');
-            $cn->editor($e->requestor->id);
-            $e->update_asset_call_number($cn) or return $e->die_event;
+            $evt = OpenILS::Application::Cat::AssetCommon->delete_volume(
+                $e, $cn, 
+                1, # override
+                0, # delete copies
+                1  # skip copy checks
+            );
+
+            return $evt if $evt;
 
         } else {
             # No matching CN exists.  Point our CN at the target bib.
@@ -4304,6 +4308,8 @@ sub transfer_order_volume {
         }
     }
 
+    # Copies need to be migrated to the target call number.
+
     ($target_cn, $evt) = 
         OpenILS::Application::Cat::AssetCommon->find_or_create_volume(
             $e, $cn->label, $bib_id, $cn->owning_lib, 
@@ -4314,7 +4320,7 @@ sub transfer_order_volume {
 
     # ... transfer copies.
     # Transfer order copies to the new call number.
-    for my $copy ($cn_copies) {
+    for my $copy (@$cn_copies) {
         $copy->call_number($target_cn->id);
         $copy->edit_date('now');
         $copy->editor($e->requestor->id);