Bug 36834 - (Bug 29697 follow-up) Koha explodes when trying to open in Labeled MARC view a bibliographic record with an invalid biblionumber
Summary: (Bug 29697 follow-up) Koha explodes when trying to open in Labeled MARC view ...
Status: Pushed to oldstable
Alias: None
Product: Koha
Classification: Unclassified
Component: Staff interface (show other bugs)
Version: unspecified
Hardware: All All
: P5 - low minor (vote)
Assignee: Janusz Kaczmarek
QA Contact: Martin Renvoize
URL:
Keywords:
Depends on: 29697
Blocks:
  Show dependency treegraph
 
Reported: 2024-05-11 08:33 UTC by Janusz Kaczmarek
Modified: 2024-05-31 13:11 UTC (History)
6 users (show)

See Also:
Change sponsored?: ---
Patch complexity: Trivial patch
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
24.05.00,23.11.06,23.05.12


Attachments
Bug 36834: (Bug 29697 follow-up) Koha explodes when trying to open in Labeled MARC view a bibliographic record with an invalid biblionumber (2.14 KB, patch)
2024-05-11 08:54 UTC, Janusz Kaczmarek
Details | Diff | Splinter Review
Bug 36834: (Bug 29697 follow-up) Koha explodes when trying to open in Labeled MARC view a bibliographic record with an invalid biblionumber (2.19 KB, patch)
2024-05-11 11:42 UTC, Roman Dolny
Details | Diff | Splinter Review
Bug 36834: (Bug 29697 follow-up) Koha explodes when trying to open in Labeled MARC view a bibliographic record with an invalid biblionumber (2.25 KB, patch)
2024-05-15 06:50 UTC, Martin Renvoize
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Janusz Kaczmarek 2024-05-11 08:33:44 UTC
After changes made in catalogue/labeledMARCdetail.pl with the bug 29697 when trying to open the Labeled MARC view with biblionumber=<invalid_number> (e.g. a deleted biblionumber) Koha explodes with a message << Can't call method "metadata" on an undefined value at /kohadevbox/koha/catalogue/labeledMARCdetail.pl line 59 >>
Comment 1 Janusz Kaczmarek 2024-05-11 08:54:23 UTC
Created attachment 166611 [details] [review]
Bug 36834: (Bug 29697 follow-up) Koha explodes when trying to open in Labeled MARC view a bibliographic record with an invalid biblionumber

After changes made in catalogue/labeledMARCdetail.pl with the bug 29697
when trying to open the Labeled MARC view with
biblionumber=<invalid_number> (e.g. a deleted biblionumber) Koha explodes
with a message << Can't call method "metadata" on an undefined value at
/kohadevbox/koha/catalogue/labeledMARCdetail.pl line 59 >>

Test plan:
==========
1. Activate the viewLabeledMARC syspref.
2. Try to open a biblio record in Labeled MARC view, 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/catalogue/labeledMARCdetail.pl?biblionumber=1234567
   Koha should explode with the message:
   Can't call method "metadata" on an undefined value at
   /kohadevbox/koha/catalogue/labeledMARCdetail.pl line 59
3. Apply the patch; restart_all.
4. Repeat p. 2.  You should get a regular page with the info "The record you
   requested does not exist (1234567)".
Comment 2 Roman Dolny 2024-05-11 11:42:10 UTC
Created attachment 166612 [details] [review]
Bug 36834: (Bug 29697 follow-up) Koha explodes when trying to open in Labeled MARC view a bibliographic record with an invalid biblionumber

After changes made in catalogue/labeledMARCdetail.pl with the bug 29697
when trying to open the Labeled MARC view with
biblionumber=<invalid_number> (e.g. a deleted biblionumber) Koha explodes
with a message << Can't call method "metadata" on an undefined value at
/kohadevbox/koha/catalogue/labeledMARCdetail.pl line 59 >>

Test plan:
==========
1. Activate the viewLabeledMARC syspref.
2. Try to open a biblio record in Labeled MARC view, 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/catalogue/labeledMARCdetail.pl?biblionumber=1234567
   Koha should explode with the message:
   Can't call method "metadata" on an undefined value at
   /kohadevbox/koha/catalogue/labeledMARCdetail.pl line 59
3. Apply the patch; restart_all.
4. Repeat p. 2.  You should get a regular page with the info "The record you
   requested does not exist (1234567)".

Signed-off-by: Roman Dolny <roman.dolny@jezuici.pl>
Comment 3 Martin Renvoize 2024-05-15 06:50:02 UTC
Created attachment 166749 [details] [review]
Bug 36834: (Bug 29697 follow-up) Koha explodes when trying to open in Labeled MARC view a bibliographic record with an invalid biblionumber

After changes made in catalogue/labeledMARCdetail.pl with the bug 29697
when trying to open the Labeled MARC view with
biblionumber=<invalid_number> (e.g. a deleted biblionumber) Koha explodes
with a message << Can't call method "metadata" on an undefined value at
/kohadevbox/koha/catalogue/labeledMARCdetail.pl line 59 >>

Test plan:
==========
1. Activate the viewLabeledMARC syspref.
2. Try to open a biblio record in Labeled MARC view, 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/catalogue/labeledMARCdetail.pl?biblionumber=1234567
   Koha should explode with the message:
   Can't call method "metadata" on an undefined value at
   /kohadevbox/koha/catalogue/labeledMARCdetail.pl line 59
3. Apply the patch; restart_all.
4. Repeat p. 2.  You should get a regular page with the info "The record you
   requested does not exist (1234567)".

Signed-off-by: Roman Dolny <roman.dolny@jezuici.pl>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 4 Martin Renvoize 2024-05-15 06:50:18 UTC
Thanks for the fix here.

Passing QA
Comment 5 Jonathan Druart 2024-05-15 12:42:41 UTC
Why don't you reuse the same pattern as other catalogue files?

catalogue/MARCdetail.pl has

94 $record = $biblio_object->metadata->record({ embed_items => 1 }) if $biblio_object;
Comment 6 Jonathan Druart 2024-05-15 12:44:05 UTC
and catalogue/ISBDdetail.pl has yet another version...
Comment 7 Katrin Fischer 2024-05-17 08:11:10 UTC
Hi, can you please reply to Jonathan's questions?
Comment 8 Janusz Kaczmarek 2024-05-17 11:15:55 UTC
(In reply to Katrin Fischer from comment #7)
> Hi, can you please reply to Jonathan's questions?

I've seen the comment but, sincerely, I don't know what to answer.  I just fixed -- by simple means, following the Perl TMTOWTDI rule -- what had been broken by Bug 29697.  Shall I understand the question as a suggestion to rewrite the patch?  I can do it, no problem, just tell me.  But the intention behind the Jonathan's question is not clear for me.
Comment 9 Jonathan Druart 2024-05-20 11:39:11 UTC
I think this patch can go as it. But it would be nice to have a follow-up bug to standardise the different controller using similar code.
Comment 10 Katrin Fischer 2024-05-21 11:19:50 UTC
No string changes, related to another bug already in, decided to push.
Comment 11 Katrin Fischer 2024-05-21 11:41:21 UTC
Pushed for 24.05!

Well done everyone, thank you!
Comment 12 Fridolin Somers 2024-05-29 13:32:22 UTC
Pushed to 23.11.x for 23.11.06
Comment 13 Lucas Gass 2024-05-31 13:11:55 UTC
Backported to 23.05.x for upcoming 23.05.12