Bug 29788: (follow-up) Make Koha::Item->safe_to_delete use Koha::Result::Boolean
There were several wrong things in the previous patch! Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
This commit is contained in:
parent
ed5250534e
commit
78ecdc8439
|
|
@ -108,7 +108,7 @@ sub process {
|
|||
my $items = Koha::Items->search({ biblionumber => $biblionumber });
|
||||
while ( my $item = $items->next ) {
|
||||
my $deleted = $item->safe_delete;
|
||||
if( $deleted ) {
|
||||
unless ( $deleted ) {
|
||||
push @messages, {
|
||||
type => 'error',
|
||||
code => 'item_not_deleted',
|
||||
|
|
|
|||
|
|
@ -377,11 +377,13 @@ if ($op eq "additem") {
|
|||
# check that there is no issue on this item before deletion.
|
||||
my $item = Koha::Items->find($itemnumber);
|
||||
my $deleted = $item->safe_delete;
|
||||
if($deleted) {
|
||||
unless ( $deleted ) {
|
||||
print $input->redirect("additem.pl?biblionumber=$biblionumber&frameworkcode=$frameworkcode&searchid=$searchid");
|
||||
} else {
|
||||
push @errors, @{$deleted->messages}[0]->message;
|
||||
$nextop="additem";
|
||||
exit;
|
||||
}
|
||||
else {
|
||||
push @errors, @{ $deleted->messages }[0]->message;
|
||||
$nextop = "additem";
|
||||
}
|
||||
#-------------------------------------------------------------------------------
|
||||
} elsif ($op eq "delallitems") {
|
||||
|
|
@ -389,7 +391,7 @@ if ($op eq "additem") {
|
|||
my $items = Koha::Items->search({ biblionumber => $biblionumber });
|
||||
while ( my $item = $items->next ) {
|
||||
my $deleted = $item->safe_delete({ skip_record_index => 1 });
|
||||
push @errors, @{$deleted->messages}[0]->message;
|
||||
push @errors, @{$deleted->messages}[0]->message unless $deleted;
|
||||
}
|
||||
my $indexer = Koha::SearchEngine::Indexer->new({ index => $Koha::SearchEngine::BIBLIOS_INDEX });
|
||||
$indexer->index_records( $biblionumber, "specialUpdate", "biblioserver" );
|
||||
|
|
|
|||
Loading…
Reference in New Issue