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

(-)a/C4/Items.pm (-9 / +19 lines)
Lines 608-628 Exported function (core API) for deleting an item record in Koha. Link Here
608
608
609
sub DelItem {
609
sub DelItem {
610
    my ( $dbh, $biblionumber, $itemnumber ) = @_;
610
    my ( $dbh, $biblionumber, $itemnumber ) = @_;
611
    
611
612
    # FIXME check the item has no current issues
612
    # FIXME: Why pass $dbh in? We can get it from C4::Context
613
    # FIXME: Why pass $biblionumber in? It would be safer to get it via the itemnumber
614
  
615
    return unless ( DelItemCheck( $dbh, $biblionumber, $itemnumber ) eq '1' );
613
    
616
    
614
    _koha_delete_item( $dbh, $itemnumber );
617
    _koha_delete_item( $dbh, $itemnumber );
615
618
616
    # get the MARC record
619
    # get the MARC record
617
    my $record = GetMarcBiblio($biblionumber);
620
    my $record = GetMarcBiblio($biblionumber);
618
    ModZebra( $biblionumber, "specialUpdate", "biblioserver" );
619
621
620
    # backup the record
622
    if ($record) {
621
    my $copy2deleted = $dbh->prepare("UPDATE deleteditems SET marc=? WHERE itemnumber=?");
623
622
    $copy2deleted->execute( $record->as_usmarc(), $itemnumber );
624
        ModZebra( $biblionumber, "specialUpdate", "biblioserver" );
623
    # This last update statement makes that the timestamp column in deleteditems is updated too. If you remove these lines, please add a line to update the timestamp separately. See Bugzilla report 7146 and Biblio.pm (DelBiblio).
625
626
        # backup the record
627
        my $copy2deleted =
628
          $dbh->prepare("UPDATE deleteditems SET marc=? WHERE itemnumber=?");
629
        $copy2deleted->execute( $record->as_usmarc(), $itemnumber );
630
        # This last update statement makes that the timestamp column in deleteditems is updated too. 
631
        # If you remove these lines, please add a line to update the timestamp separately. 
632
        # See Bugzilla report 7146 and Biblio.pm (DelBiblio).
633
    } else {
634
        warn "Something's wrong! Cannot backup item because record doesn't exist! Biblionumber: $biblionumber, Itemnumber: $itemnumber";
635
    }
624
636
625
    #search item field code
626
    logaction("CATALOGUING", "DELETE", $itemnumber, "item") if C4::Context->preference("CataloguingLog");
637
    logaction("CATALOGUING", "DELETE", $itemnumber, "item") if C4::Context->preference("CataloguingLog");
627
}
638
}
628
639
629
- 

Return to bug 9231