From 295b0fe521aa8e1b97c6d663185e5e4ae900aa79 Mon Sep 17 00:00:00 2001 From: Janusz Kaczmarek Date: Mon, 6 May 2024 09:08:50 +0000 Subject: [PATCH] Bug 36786: (Bug 31791 follow-up) Koha explodes when trying to edit a biblio with invalid biblionumber After changes made to addbiblio with the bug 31791, when trying to open the editor with biblionumber= (e.g. a deleted biblionumber) Koha explodes with a message << Can't call method "can_be_edited" on an undefined value at /kohadevbox/koha/cataloguing/addbiblio.pl line 555 >> Test plan: ========== 1. Try to edit a biblio giving as a biblionumber (in URL) a non-existing biblionumber, e.g. in ktd, with standard ktd test data: http://your_ktd:8081/cgi-bin/koha/cataloguing/addbiblio.pl?biblionumber=1234567 Koha should explode with the message: Can't call method "can_be_edited" on an undefined value at /kohadevbox/koha/cataloguing/addbiblio.pl line 555 2. Apply the patch; restart_all. 3. Repeat p.1. You should get the 403 error page. Sponsored-by: Ignatianum University in Cracow Signed-off-by: Roman Dolny --- cataloguing/addbiblio.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cataloguing/addbiblio.pl b/cataloguing/addbiblio.pl index 3d92cdad1f..731f6166d3 100755 --- a/cataloguing/addbiblio.pl +++ b/cataloguing/addbiblio.pl @@ -552,7 +552,7 @@ if ($biblionumber) { $template->param( bib_doesnt_exist => 1 ); } - unless ( $biblio->can_be_edited($logged_in_patron) ) { + unless ( $biblio && $biblio->can_be_edited($logged_in_patron) ) { print $input->redirect("/cgi-bin/koha/errors/403.pl"); # escape early exit; } -- 2.39.2