@@ -, +, @@ is deleted --- Koha/Item.pm | 13 +++++++++++++ 1 file changed, 13 insertions(+) --- a/Koha/Item.pm +++ a/Koha/Item.pm @@ -217,6 +217,19 @@ sub delete { C4::Biblio::ModZebra( $self->biblionumber, "specialUpdate", "biblioserver" ) unless $params->{skip_modzebra_update}; + if ( C4::Context->preference('EnableVolumes') ) { + my $volume_item = + Koha::Biblio::Volume::Items->find( { itemnumber => $self->itemnumber } ); + my $volume_id = $volume_item ? $volume_item->volume_id : undef; + + # If this item is the last item on a volume, delete the volume as well + if ($volume_id) { + my $volume = Koha::Biblio::Volumes->find($volume_id); + my @volume_items = $volume->items(); + $volume->delete unless @volume_items; + } + } + $self->_after_item_action_hooks({ action => 'delete' }); logaction( "CATALOGUING", "DELETE", $self->itemnumber, "item" ) --