} 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;
}
}
+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;