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

(-)a/C4/Acquisition.pm (-1 / +6 lines)
Lines 1861-1867 sub DelOrder { Link Here
1861
    $sth->execute( $bibnum, $ordernumber );
1861
    $sth->execute( $bibnum, $ordernumber );
1862
    my @itemnumbers = GetItemnumbersFromOrder( $ordernumber );
1862
    my @itemnumbers = GetItemnumbersFromOrder( $ordernumber );
1863
    foreach my $itemnumber (@itemnumbers){
1863
    foreach my $itemnumber (@itemnumbers){
1864
        C4::Items::DelItem( $bibnum, $itemnumber );
1864
        C4::Items::DelItem(
1865
            {
1866
                biblionumber => $bibnum,
1867
                itemnumber   => $itemnumber
1868
            }
1869
        );
1865
    }
1870
    }
1866
    return;
1871
    return;
1867
}
1872
}
(-)a/C4/Items.pm (-3 / +15 lines)
Lines 632-645 sub ModDateLastSeen { Link Here
632
632
633
=head2 DelItem
633
=head2 DelItem
634
634
635
  DelItem( $biblionumber, $itemnumber );
635
  DelItem({ itemnumber => $itemnumber, [ biblionumber => $biblionumber ] } );
636
636
637
Exported function (core API) for deleting an item record in Koha.
637
Exported function (core API) for deleting an item record in Koha.
638
638
639
=cut
639
=cut
640
640
641
sub DelItem {
641
sub DelItem {
642
    my ( $biblionumber, $itemnumber ) = @_;
642
    my ( $params ) = @_;
643
644
    my $itemnumber   = $params->{itemnumber};
645
    my $biblionumber = $params->{biblionumber};
646
647
    unless ($biblionumber) {
648
        $biblionumber = C4::Biblio::GetBiblionumberFromItemnumber($itemnumber);
649
    }
643
650
644
    # FIXME check the item has no current issues
651
    # FIXME check the item has no current issues
645
    _koha_delete_item( $itemnumber );
652
    _koha_delete_item( $itemnumber );
Lines 2287-2293 sub DelItemCheck { Link Here
2287
        } elsif ($countanalytics > 0){
2294
        } elsif ($countanalytics > 0){
2288
		$error = "linked_analytics";
2295
		$error = "linked_analytics";
2289
	} else {
2296
	} else {
2290
            DelItem($biblionumber, $itemnumber);
2297
            DelItem(
2298
                {
2299
                    biblionumber => $biblionumber,
2300
                    itemnumber   => $itemnumber
2301
                }
2302
            );
2291
            return 1;
2303
            return 1;
2292
        }
2304
        }
2293
    }
2305
    }
(-)a/t/db_dependent/Items.t (-2 / +1 lines)
Lines 58-64 subtest 'General Add, Get and Del tests' => sub { Link Here
58
    cmp_ok($moditem->{'barcode'}, '==', '987654321', 'Modified item barcode successfully to: '.$moditem->{'barcode'} . '.');
58
    cmp_ok($moditem->{'barcode'}, '==', '987654321', 'Modified item barcode successfully to: '.$moditem->{'barcode'} . '.');
59
59
60
    # Delete item.
60
    # Delete item.
61
    DelItem($bibnum, $itemnumber);
61
    DelItem({ biblionumber => $bibnum, itemnumber => $itemnumber });
62
    my $getdeleted = GetItem($itemnumber);
62
    my $getdeleted = GetItem($itemnumber);
63
    is($getdeleted->{'itemnumber'}, undef, "Item deleted as expected.");
63
    is($getdeleted->{'itemnumber'}, undef, "Item deleted as expected.");
64
64
65
- 

Return to bug 12583