View | Details | Raw Unified | Return to bug 24857
Collapse All | Expand All

(-)a/C4/Items.pm (-1 / +14 lines)
Lines 611-616 sub DelItem { Link Here
611
    # If there is no biblionumber for the given itemnumber, there is nothing to delete
611
    # If there is no biblionumber for the given itemnumber, there is nothing to delete
612
    return 0 unless $biblionumber;
612
    return 0 unless $biblionumber;
613
613
614
    # Find the volume_item now, it will be deleted when the item is deleted
615
    my $volume_id;
616
    if ( C4::Context->preference('EnableVolumes') ) {
617
        my $volume_item = Koha::Biblio::Volume::Items->find({ itemnumber => $itemnumber });
618
        $volume_id = $volume_item ? $volume_item->volume_id : undef;
619
    }
620
614
    # FIXME check the item has no current issues
621
    # FIXME check the item has no current issues
615
    my $deleted = _koha_delete_item( $itemnumber );
622
    my $deleted = _koha_delete_item( $itemnumber );
616
623
Lines 618-623 sub DelItem { Link Here
618
625
619
    _after_item_action_hooks({ action => 'delete', item_id => $itemnumber });
626
    _after_item_action_hooks({ action => 'delete', item_id => $itemnumber });
620
627
628
    # If this item is the last item on a volume, delete the volume as well
629
    if ( $volume_id ) {
630
        my $volume = Koha::Biblio::Volumes->find( $volume_id );
631
        my @volume_items = $volume->items();
632
        $volume->delete unless @volume_items;
633
    }
634
621
    #search item field code
635
    #search item field code
622
    logaction("CATALOGUING", "DELETE", $itemnumber, "item") if C4::Context->preference("CataloguingLog");
636
    logaction("CATALOGUING", "DELETE", $itemnumber, "item") if C4::Context->preference("CataloguingLog");
623
    return $deleted;
637
    return $deleted;
624
- 

Return to bug 24857