From 98d4fd4946c7d534a4287624520a6938bbd22fa0 Mon Sep 17 00:00:00 2001 From: Bill Erickson Date: Fri, 23 Sep 2011 17:45:39 -0400 Subject: [PATCH] Acq: (un)receive w/o assets should not attempt a copy update When receiveing a lineitem for a PO that was activated without assets, avoid any attempts to update said non-existent assets. Signed-off-by: Bill Erickson Signed-off-by: Mike Rylander --- .../perlmods/lib/OpenILS/Application/Acq/Order.pm | 28 ++++++++++++---------- 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Acq/Order.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Acq/Order.pm index 8e478cad88..1b1aff30e9 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Acq/Order.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Acq/Order.pm @@ -523,13 +523,15 @@ sub receive_lineitem_detail { $lid->recv_time('now'); $e->update_acq_lineitem_detail($lid) or return 0; - my $copy = $e->retrieve_asset_copy($lid->eg_copy_id) or return 0; - $copy->status(OILS_COPY_STATUS_IN_PROCESS); - $copy->edit_date('now'); - $copy->editor($e->requestor->id); - $copy->creator($e->requestor->id) if $U->ou_ancestor_setting_value( - $e->requestor->ws_ou, 'acq.copy_creator_uses_receiver', $e); - $e->update_asset_copy($copy) or return 0; + if ($lid->eg_copy_id) { + my $copy = $e->retrieve_asset_copy($lid->eg_copy_id) or return 0; + $copy->status(OILS_COPY_STATUS_IN_PROCESS); + $copy->edit_date('now'); + $copy->editor($e->requestor->id); + $copy->creator($e->requestor->id) if $U->ou_ancestor_setting_value( + $e->requestor->ws_ou, 'acq.copy_creator_uses_receiver', $e); + $e->update_asset_copy($copy) or return 0; + } $mgr->add_lid; @@ -561,11 +563,13 @@ sub rollback_receive_lineitem_detail { $lid->clear_recv_time; $e->update_acq_lineitem_detail($lid) or return 0; - my $copy = $e->retrieve_asset_copy($lid->eg_copy_id) or return 0; - $copy->status(OILS_COPY_STATUS_ON_ORDER); - $copy->edit_date('now'); - $copy->editor($e->requestor->id); - $e->update_asset_copy($copy) or return 0; + if ($lid->eg_copy_id) { + my $copy = $e->retrieve_asset_copy($lid->eg_copy_id) or return 0; + $copy->status(OILS_COPY_STATUS_ON_ORDER); + $copy->edit_date('now'); + $copy->editor($e->requestor->id); + $e->update_asset_copy($copy) or return 0; + } $mgr->add_lid; return $lid; -- 2.11.0