Bugzilla – Attachment 132052 Details for
Bug 29788
Make Koha::Item->safe_to_delete return a Koha::Result::Boolean object
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 29788: (follow-up) Make Koha::Item->safe_to_delete use Koha::Result::Boolean
Bug-29788-follow-up-Make-KohaItem-safetodelete-use.patch (text/plain), 2.48 KB, created by
Jonathan Druart
on 2022-03-23 11:31:33 UTC
(
hide
)
Description:
Bug 29788: (follow-up) Make Koha::Item->safe_to_delete use Koha::Result::Boolean
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2022-03-23 11:31:33 UTC
Size:
2.48 KB
patch
obsolete
>From 446ec0a519be6f3332f373d2e559d52561ef3583 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Wed, 23 Mar 2022 12:30:42 +0100 >Subject: [PATCH] Bug 29788: (follow-up) Make Koha::Item->safe_to_delete use > Koha::Result::Boolean > >There were several wrong things in the previous patch! >--- > Koha/BackgroundJob/BatchDeleteBiblio.pm | 2 +- > cataloguing/additem.pl | 12 +++++++----- > 2 files changed, 8 insertions(+), 6 deletions(-) > >diff --git a/Koha/BackgroundJob/BatchDeleteBiblio.pm b/Koha/BackgroundJob/BatchDeleteBiblio.pm >index 15246feae05..0c95c6352ce 100644 >--- a/Koha/BackgroundJob/BatchDeleteBiblio.pm >+++ b/Koha/BackgroundJob/BatchDeleteBiblio.pm >@@ -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', >diff --git a/cataloguing/additem.pl b/cataloguing/additem.pl >index 4588b13fb58..1ad9edb5036 100755 >--- a/cataloguing/additem.pl >+++ b/cataloguing/additem.pl >@@ -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" ); >-- >2.25.1
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 29788
:
128993
|
129010
|
129013
|
129018
|
129075
|
129076
|
129077
|
129097
|
129098
|
129169
|
129170
|
129326
| 132052