added logic to see if an updated volume was attempting to create a duplicate - return...
authorerickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Tue, 24 Oct 2006 20:21:07 +0000 (20:21 +0000)
committererickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Tue, 24 Oct 2006 20:21:07 +0000 (20:21 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@6503 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/src/perlmods/OpenILS/Application/Cat.pm

index 658a244..3a6710f 100644 (file)
@@ -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;