In opac search results we call get_coins in an eval so it can load, on other scripts we don't The get_coins routine calls: $title = $record->field('245')->as_string('ab'); With no check that the 245 exists. Simple fix would be to call get_coins in an eval everywhere More comprehensive would be to fall back to 880 field linked ot 245, and then fallback to blank This only affects MARC21 I believe as the UNIMARC implementation gets the field directly without as_string To recreate: 1 - Load attached record or create a record with 880 and no 245 2 - Enable COinSinOpac 3 - Search for record in staff or opac, it loads in results 4 - Add item to a public list, cannot view in opac 5 - Try to view ISBD or MARC tab on staff client, it fails When indexing in ES we convert an 880 to its linked field so the record is searchable, so we could make that a sbroutine
Created attachment 106476 [details] A bib record with no 245 and 880 fields from our catalog I'm uploading one of our MARC21 records, exported from OCLC that has no 245 and has the 880 fields in it that might be useful for folks to use in testing.
Created attachment 107563 [details] [review] 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
(In reply to Nick Clemens from comment #0) > In opac search results we call get_coins in an eval so it can load, on other > scripts we don't We surround it by an eval in detail.pl to deal with encoding problems, what we don't on other views. I think this patch deals correctly with the problem you reported.
Nick, don't forget to copy the error message when a 500 is reported :)
I'm going to sign off--everything worked according to the test plan when I tried to sign off, and the ISBD view didn't fail, but it also didn't include any data from the 880 10 $6 245-00, i.e.: 880 1 0 _6245-00 _aSS President Coolidge = [Президент Кулидж] : So the "Normal" view looks like this: SS President Coolidge = [Президент Кулидж] : Под водой с Вадим Малыш / By: Malysh, Vadim [filmmaker.] ...etc. But the ISBD view like this: Malysh, Vadim, - 1 videodisc (11:41 min.) : sound, color with black and white sequences ; 4 3/4 in. TEST RECORD.--h2 Title from disc. Narrator, Nikita Puryzhinsky. DVD. In Russian with English subtitles. Subjects--Corporate Names: President Coolidge (Steamship) Subjects--Topical Terms: Deep diving--Vanuatu--Espíritu Santo Island. Shipwrecks--Vanuatu--Espíritu Santo Island. LC Class. No.: VK1255.P703 / M35 2009 So perhaps getting that 880 10 $6 245-00 $a data into the ISBD view should be a separate bug? Because the ISBD view isn't very useful without the title!:)
Created attachment 110941 [details] [review] 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>
Created attachment 111153 [details] [review] 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>
Created attachment 111366 [details] [review] Bug 25913: Get the correct return of AddBiblio We need the parenthesis to get the biblionumber and not the biblioitemnumber, in case there is a discrepancy.
Pushed to master for 20.11, thanks to everybody involved!
backported to 20.05.x for 20.05.05
backported to 19.11.x for 19.11.11
Not backported to oldoldstable (19.05.x). Feel free to ask if it's needed.