From 6511dce3a4f9d276c8fabf6280da517adf67e997 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 Content-Type: text/plain; charset=utf-8 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 --- 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.30.2