added protection from fleshed stat-cats in entries on update
authorerickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Thu, 31 Aug 2006 16:10:00 +0000 (16:10 +0000)
committererickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Thu, 31 Aug 2006 16:10:00 +0000 (16:10 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@5806 dcc99617-32d9-48b4-a31d-7c20da2025e4

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

index d19a144..42b80d1 100644 (file)
@@ -1173,7 +1173,9 @@ sub update_copy_stat_entries {
                        }
                }
        }
-       
+
+       return undef if $copy->isdeleted;
+
        # go through the stat cat update/create process
        for my $entry (@$entries) { 
                next unless $entry;
@@ -1182,8 +1184,10 @@ sub update_copy_stat_entries {
                next if( grep{$_->stat_cat_entry == $entry->id} @$maps );
        
                my $new_map = Fieldmapper::asset::stat_cat_entry_copy_map->new();
+
+               my $sc = ref($entry->stat_cat) ? $entry->stat_cat->id : $entry->stat_cat;
                
-               $new_map->stat_cat( $entry->stat_cat );
+               $new_map->stat_cat( $sc );
                $new_map->stat_cat_entry( $entry->id );
                $new_map->owning_copy( $copy->id );
 
@@ -1201,7 +1205,6 @@ sub create_volume {
        my( $override, $editor, $vol ) = @_;
        my $evt;
 
-
        # first lets see if there are any collisions
        my $vols = $editor->search_asset_call_number( { 
                        owning_lib      => $vol->owning_lib,