From: erickson Date: Tue, 24 Oct 2006 20:21:07 +0000 (+0000) Subject: added logic to see if an updated volume was attempting to create a duplicate - return... X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=b2abe3e4a3134fbd078610fd797c3fbc2a8b82bf;p=Evergreen.git added logic to see if an updated volume was attempting to create a duplicate - returns VOLUME_LABEL_EXISTS if so git-svn-id: svn://svn.open-ils.org/ILS/trunk@6503 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- diff --git a/Open-ILS/src/perlmods/OpenILS/Application/Cat.pm b/Open-ILS/src/perlmods/OpenILS/Application/Cat.pm index 658a244728..3a6710face 100644 --- a/Open-ILS/src/perlmods/OpenILS/Application/Cat.pm +++ b/Open-ILS/src/perlmods/OpenILS/Application/Cat.pm @@ -958,8 +958,7 @@ sub fleshed_volume_update { } elsif( $vol->ischanged ) { $logger->info("vol-update: update volume"); - return $editor->event unless - $editor->update_asset_call_number($vol); + $evt = update_volume($vol, $editor); return $evt if $evt; } @@ -976,6 +975,28 @@ sub fleshed_volume_update { } +sub update_volume { + my $vol = shift; + my $editor = shift; + + my $vols = $editor->search_asset_call_number( { + owning_lib => $vol->owning_lib, + record => $vol->record, + label => $vol->label, + deleted => 'f' + } + ); + + # There exists a different volume in the DB with the same properties + return OpenILS::Event->new('VOLUME_LABEL_EXISTS', payload => $vol->id) + if grep { $_->id ne $vol->id } @$vols; + + return $editor->event unless $editor->update_asset_call_number($vol); + return undef; +} + + + sub copy_perm_org { my( $vol, $copy ) = @_; my $org = $vol->owning_lib;