Bug 36791

Summary: Koha explodes when trying to edit an authority record with an invalid authid
Product: Koha Reporter: Janusz Kaczmarek <januszop>
Component: MARC Authority data supportAssignee: Janusz Kaczmarek <januszop>
Status: Pushed to oldstable --- QA Contact: Emily Lamancusa <emily.lamancusa>
Severity: normal    
Priority: P5 - low CC: emily.lamancusa, fridolin.somers, lucas
Version: unspecified   
Hardware: All   
OS: All   
Change sponsored?: Sponsored Patch complexity: ---
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
24.05.00,23.11.06,23.05.12
Bug Depends on:    
Bug Blocks: 36832    
Attachments: Bug 36791: Koha explodes when trying to edit an authority rec. with an invalid authid
Bug 36791: Koha explodes when trying to edit an authority rec. with an invalid authid
Bug 36791: Koha explodes when trying to edit an authority rec. with an invalid authid
Bug 36791: (QA follow-up) Simplify conditional
Bug 36832: (bug 36791 follow-up) Allow authid=0

Description Janusz Kaczmarek 2024-05-06 11:19:04 UTC
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 >>
Comment 1 Janusz Kaczmarek 2024-05-06 11:54:30 UTC
Created attachment 166214 [details] [review]
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
Comment 2 Roman Dolny 2024-05-06 15:51:19 UTC
Created attachment 166234 [details] [review]
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>
Comment 3 Emily Lamancusa 2024-05-09 15:34:56 UTC
Created attachment 166465 [details] [review]
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>
Comment 4 Emily Lamancusa 2024-05-09 15:34:59 UTC
Created attachment 166466 [details] [review]
Bug 36791: (QA follow-up) Simplify conditional

Signed-off-by: Emily Lamancusa <emily.lamancusa@montgomerycountymd.gov>
Comment 5 Emily Lamancusa 2024-05-09 15:36:34 UTC
Nice catch! Passing QA
Comment 6 Katrin Fischer 2024-05-10 12:13:19 UTC
Pushed for 24.05!

Well done everyone, thank you!
Comment 7 Emily Lamancusa 2024-05-10 18:08:19 UTC Comment hidden (obsolete)
Comment 8 Fridolin Somers 2024-05-22 12:49:23 UTC
Pushed to 23.11.x for 23.11.06
Comment 9 Lucas Gass 2024-05-23 14:16:07 UTC
Backported to 23.05.x for upcoming 23.05.12