From e4ab9602c036f246797ba1ba09e1624a678ea1b3 Mon Sep 17 00:00:00 2001 From: Marcel de Rooy Date: Wed, 19 Oct 2022 13:48:18 +0000 Subject: [PATCH] Bug 31873: Check ->find before calling ->safe_delete When there is no item, you cannot safely delete it :) Resolve this warning: Can't call method "safe_delete" on an undefined value at /usr/share/koha/cataloguing/additem.pl line 379 (Line numbers may vary across versions.) Test plan: Open item editor. Add a new item. Add another tab with same form. Delete new item. Go back to former tab. Try to delete again. You should see an alert now on top of the form. Signed-off-by: Marcel de Rooy Signed-off-by: David Nind Signed-off-by: Martin Renvoize Signed-off-by: Tomas Cohen Arazi (cherry picked from commit 7d8a35585b4d2047e404fb4a1ce19596737d68ab) Signed-off-by: Lucas Gass (cherry picked from commit 65d267dd903c9158f63b4e91ff791eb0398e2849) Signed-off-by: Arthur Suzuki --- cataloguing/additem.pl | 1 + koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/additem.tt | 1 + 2 files changed, 2 insertions(+) diff --git a/cataloguing/additem.pl b/cataloguing/additem.pl index 42e4781158..b40edc4f5d 100755 --- a/cataloguing/additem.pl +++ b/cataloguing/additem.pl @@ -47,6 +47,7 @@ use Storable qw( freeze thaw ); use URI::Escape qw( uri_escape_utf8 ); use C4::Members; use Koha::UI::Form::Builder::Item; +use Koha::Result::Boolean; use MARC::File::XML; use URI::Escape qw( uri_escape_utf8 ); diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/additem.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/additem.tt index aa02320f52..42acc93f5c 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/additem.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/additem.tt @@ -62,6 +62,7 @@ [% IF ( not_same_branch ) %]
Cannot delete: The items do not belong to your library.
[% END %] [% IF ( linked_analytics ) %]
Cannot delete: item has linked analytics..
[% END %] [% IF last_item_for_hold %]
Cannot delete: Last item for bibliographic record with biblio-level hold on it.
[% END %] +[% IF item_not_found %]
Cannot delete: Item not found.
[% END %]
[% IF items %] -- 2.20.1