From 0677a53e1445342ac4927a1177100f69e4f02271 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 --- cataloguing/additem.pl | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/cataloguing/additem.pl b/cataloguing/additem.pl index 1e397a0de2..bd7b297109 100755 --- a/cataloguing/additem.pl +++ b/cataloguing/additem.pl @@ -549,7 +549,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