$biblionumber = C4::Biblio::GetBiblionumberFromItemnumber($itemnumber);
}
+ # If there is no biblionumber for the given itemnumber, there is nothing to delete
+ return 0 unless $biblionumber;
+
# FIXME check the item has no current issues
- _koha_delete_item( $itemnumber );
+ my $deleted = _koha_delete_item( $itemnumber );
# get the MARC record
my $record = GetMarcBiblio($biblionumber);
#search item field code
logaction("CATALOGUING", "DELETE", $itemnumber, "item") if C4::Context->preference("CataloguingLog");
+ return $deleted;
}
=head2 CheckItemPreSave
my $sth = $dbh->prepare("SELECT * FROM items WHERE itemnumber=?");
$sth->execute($itemnum);
my $data = $sth->fetchrow_hashref();
+
+ # There is no item to delete
+ return 0 unless $data;
+
my $query = "INSERT INTO deleteditems SET ";
my @bind = ();
foreach my $key ( keys %$data ) {
# delete from items table
$sth = $dbh->prepare("DELETE FROM items WHERE itemnumber=?");
- $sth->execute($itemnum);
- return;
+ my $deleted = $sth->execute($itemnum);
+ return ( $deleted == 1 ) ? 1 : 0;
}
=head2 _marc_from_item_hash
$authorised_lib{$value} = $lib;
}
}
- $subfield_data{marc_value} = CGI::scrolling_list(
- -name => 'field_value',
- -values => \@authorised_values,
- -default => "$defaultvalue",
- -labels => \%authorised_lib,
- -size => 1,
- -tabindex => '',
- -multiple => 0,
- );
+ $subfield_data{marc_value} = {
+ type => 'select',
+ values => \@authorised_values,
+ default => "$defaultvalue",
+ labels => \%authorised_lib,
+ };
} elsif ( $tagslib->{$tag}->{$subfield}->{value_builder} ) {
# opening plugin
my $plugin = C4::Context->intranetdir . "/cataloguing/value_builder/" . $tagslib->{$tag}->{$subfield}->{'value_builder'};