From 4e582d1e4f18b6ee4dfe215ce6bbf20a07fa1511 Mon Sep 17 00:00:00 2001 From: Bill Erickson Date: Mon, 20 Jun 2011 11:17:29 -0400 Subject: [PATCH] Bug Fix: Clear empty objects from original callnumber When updating the callnumber on a copy, make sure we fetch the original callnumber to test for emptiness and cleanup, instead of trying to clean up the newly assigned callnumber (which will never be "empty"). Signed-off-by: Bill Erickson --- Open-ILS/src/perlmods/lib/OpenILS/Application/Cat/AssetCommon.pm | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Cat/AssetCommon.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Cat/AssetCommon.pm index 047338c113..11ecdfc3b3 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Cat/AssetCommon.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Cat/AssetCommon.pm @@ -200,7 +200,10 @@ sub update_copy { $logger->info("vol-update: updating copy ".$copy->id); my $orig_copy = $editor->retrieve_asset_copy($copy->id); - my $orig_vol = $editor->retrieve_asset_call_number($copy->call_number); + + # Call-number may have changed, find the original + my $orig_vol_id = $editor->json_query({select => {acp => ['call_number']}, from => 'acp', where => {id => $copy->id}}); + my $orig_vol = $editor->retrieve_asset_call_number($orig_vol_id->[0]->{call_number}); $copy->editor($editor->requestor->id); $copy->edit_date('now'); -- 2.11.0