Bug 25913: Prevent get_coins to crash if record does not have title
authorJonathan Druart <jonathan.druart@bugs.koha-community.org>
Thu, 30 Jul 2020 08:41:45 +0000 (10:41 +0200)
committerAleisha Amohia <aleishaamohia@hotmail.com>
Tue, 27 Oct 2020 04:35:41 +0000 (17:35 +1300)
commit4f677624b228c5389c5640ef1834ae503b7cdf20
tree9bd425a7c6578ff8a695d9ad59a9f002800bd532
parentf832ae20dc8db5a10154c7a1a60096c39ff6b08e
Bug 25913: Prevent get_coins to crash if record does not have title

If a bibliographic record does not have a title, get_coins will crash
with
Can't call method "as_string" on an undefined value at /kohadevbox/koha/Koha/Biblio.pm line 645
Koha::Biblio::get_coins('Koha::Biblio=HASH(0x5558f91bb740)') called at /kohadevbox/koha/catalogue/ISBDdetail.pl line 144

We can handle that situation easily by checking the existence of the
title field.

Test plan:
1. Create a record without 245
2. Enable COinSinOpac
4. Go to the ISBD detail view
=> It must not fail with this patch applied

Signed-off-by: Heather Hernandez <heather_hernandez@nps.gov>
Signed-off-by: Joonas Kylmälä <joonas.kylmala@helsinki.fi>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 64c939ca80a306af2560c99da0f58b1aeaed13c6)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit d9599a6d3376df3479e040628d61b55aa88e1966)

Signed-off-by: Aleisha Amohia <aleishaamohia@hotmail.com>
Koha/Biblio.pm
t/db_dependent/Koha/Biblio.t