From: Jason Etheridge Date: Thu, 5 Jan 2012 22:23:39 +0000 (-0500) Subject: Use the restrict_copy_delete field on copy status X-Git-Tag: sprint4-merge-nov22~4613 X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=24cdcd766ca3dc819b49790ac9cdfeea7c2dc928;p=working%2FEvergreen.git Use the restrict_copy_delete field on copy status to determine when to throw a COPY_DELETE_WARNING event Signed-off-by: Jason Etheridge --- 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 71a2020e59..ff750991fe 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Cat/AssetCommon.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Cat/AssetCommon.pm @@ -319,17 +319,16 @@ sub update_fleshed_copies { sub delete_copy { my($class, $editor, $override, $vol, $copy, $retarget_holds, $force_delete_empty_bib, $skip_empty_cleanup) = @_; - return $editor->event unless - $editor->allowed('DELETE_COPY', $class->copy_perm_org($vol, $copy)); + return $editor->event unless + $editor->allowed('DELETE_COPY', $class->copy_perm_org($vol, $copy)); - my $stat = $U->copy_status($copy->status)->id; - - unless($override) { - return OpenILS::Event->new('COPY_DELETE_WARNING', payload => $copy->id ) - if $stat == OILS_COPY_STATUS_CHECKED_OUT or - $stat == OILS_COPY_STATUS_IN_TRANSIT or - $stat == OILS_COPY_STATUS_ON_HOLDS_SHELF or - $stat == OILS_COPY_STATUS_ILL; + my $stat = $U->copy_status($copy->status); + if ($U->is_true($stat->restrict_copy_delete)) { + if ($override) { + return $editor->event unless $editor->allowed('COPY_DELETE_WARNING.override', $class->copy_perm_org($vol, $copy)) + } else { + return OpenILS::Event->new('COPY_DELETE_WARNING', payload => $copy->id ) + } } $logger->info("vol-update: deleting copy ".$copy->id);