Bug 36791: Koha explodes when trying to edit an authority rec. with an invalid authid
authorJanusz Kaczmarek <januszop@gmail.com>
Mon, 6 May 2024 11:44:26 +0000 (11:44 +0000)
committerFridolin Somers <fridolin.somers@biblibre.com>
Wed, 22 May 2024 12:48:24 +0000 (14:48 +0200)
commitb9ba92c1537435ee9906f72770680c985083645a
tree2ebf01c1f9e064fa5bb2931ed8f96bf5af5cba75
parentdce78a0ecd7530fd5f372c3b5d8e92998a983529
Bug 36791: Koha explodes when trying to edit an authority rec. with an invalid authid

When trying to open the authority editor with authid=<invalid_authid>
(e.g. a deleted authid) Koha explodes with a message:
Can't call method "authtypecode" on an undefined value at
/kohadevbox/koha/authorities/authorities.pl line 556

This this because authtypecode method is called on the result of
->find without verifying that it was succesful.

Test plan:
==========
1. Try to edit an auth rec. giving as a authid (in URL) a non-existing
   authid, e.g. in ktd, with standard ktd test data:
   http://your_ktd:8081/cgi-bin/koha/authorities/authorities.pl?authid=100000
   Koha should explode with the message:
   Can't call method "authtypecode" on an undefined value at
   /kohadevbox/koha/authorities/authorities.pl line 556
2. Apply the patch; restart_all.
3. Repeat p. 1.  You should get the 404 error page.

Sponsored-by: Ignatianum University in Cracow
Signed-off-by: Roman Dolny <roman.dolny@jezuici.pl>
Signed-off-by: Emily Lamancusa <emily.lamancusa@montgomerycountymd.gov>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 18843cabdb1697fda2eb2d9c3c7f96b58f277813)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
authorities/authorities.pl