From 04feadb6bf680db05c0921560082c924ea5a8141 Mon Sep 17 00:00:00 2001 From: Marcel de Rooy Date: Thu, 2 Nov 2023 10:47:50 +0000 Subject: [PATCH] Bug 32379: Add check on existing item Simplest fix; bail out with output_error. Test plan: Try /cgi-bin/koha/cataloguing/additem.pl?biblionumber=1&op=saveitem&itemnumber=999999 Note: Replace 1 by existing biblionumber, and iitem 999999 should not exist. You should get the 404 screen now. Signed-off-by: Marcel de Rooy Signed-off-by: David Nind Signed-off-by: Katrin Fischer Signed-off-by: Tomas Cohen Arazi (cherry picked from commit 0677a53e1445342ac4927a1177100f69e4f02271) Signed-off-by: Fridolin Somers (cherry picked from commit 7890c068fa5c3e51abeb94fa76f2f425af777768) Signed-off-by: Pedro Amorim --- cataloguing/additem.pl | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/cataloguing/additem.pl b/cataloguing/additem.pl index a0987ee993..0878845942 100755 --- a/cataloguing/additem.pl +++ b/cataloguing/additem.pl @@ -541,7 +541,10 @@ if ($op eq "additem") { my $itemnumber = $input->param('itemnumber'); my $item = Koha::Items->find($itemnumber); - # FIXME Handle non existent item + unless ($item) { + C4::Output::output_error( $input, '404' ); + exit; + } my $olditemlost = $item->itemlost; my @columns = Koha::Items->columns; my $new_values = $item->unblessed; -- 2.39.5