There is a bug in Koha::SearchEngine::Elasticsearc::Search->json2marc, it assumes that the MARC::Field constructor always takes >= 5 parameters. This assumption is wrong for control fields, to create a control field you need to call the constructor with: MARC::Field->new($tag, $value); Note that I got "Too much data for control field" in the _warning value of my MARC::Field because too many parameters were passed, and the value was undef. That broke the result search links (on the staff interface) for DB with biblio.biblionumber mapped with 001. Other bugs will certainly be fixed by this patch. For instance I got: GetMarcBiblio called with undefined biblionumber at /home/koha/src/opac/opac-search.pl line 664. GetCOinSBiblio called with undefined record at /home/koha/src/opac/opac-search.pl line 665. in my logs.
Created attachment 55932 [details] [review] Bug 17377: Add tests for json2marc
Created attachment 55933 [details] [review] Bug 17377: ES - Take control fields into account There is a bug in Koha::SearchEngine::Elasticsearc::Search->json2marc, it assumes that the MARC::Field constructor always takes >= 5 parameters. This assumption is wrong for control fields, to create a control field you need to call the constructor with: MARC::Field->new($tag, $value); Note that I got "Too much data for control field" in the _warning value of my MARC::Field because too many parameters were passed, and the value was undef. That broke the result search links (on the staff interface) for DB with biblio.biblionumber mapped with 001. Other bugs will certainly be fixed by this patch. For instance I got: GetMarcBiblio called with undefined biblionumber at /home/koha/src/opac/opac-search.pl line 664. GetCOinSBiblio called with undefined record at /home/koha/src/opac/opac-search.pl line 665. in my logs, with this patch I don't get them anymore. Test plan: You can try to recreate the different issues and confirm than this patch fixes them. Or just run the tests
Created attachment 55954 [details] [review] Bug 17377: Add tests for json2marc Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Created attachment 55955 [details] [review] Bug 17377: ES - Take control fields into account There is a bug in Koha::SearchEngine::Elasticsearc::Search->json2marc, it assumes that the MARC::Field constructor always takes >= 5 parameters. This assumption is wrong for control fields, to create a control field you need to call the constructor with: MARC::Field->new($tag, $value); Note that I got "Too much data for control field" in the _warning value of my MARC::Field because too many parameters were passed, and the value was undef. That broke the result search links (on the staff interface) for DB with biblio.biblionumber mapped with 001. Other bugs will certainly be fixed by this patch. For instance I got: GetMarcBiblio called with undefined biblionumber at /home/koha/src/opac/opac-search.pl line 664. GetCOinSBiblio called with undefined record at /home/koha/src/opac/opac-search.pl line 665. in my logs, with this patch I don't get them anymore. Test plan: You can try to recreate the different issues and confirm than this patch fixes them. Or just run the tests Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
I can't recreate the errors, but code looks correct Tests pass with caveat that the very first run failed, I can no longer recreate that problem though and don't see an issue in the tests
Created attachment 57620 [details] [review] [PASSED QA] Bug 17377: Add tests for json2marc Signed-off-by: Nick Clemens <nick@bywatersolutions.com> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Created attachment 57621 [details] [review] [PASSED QA] Bug 17377: ES - Take control fields into account There is a bug in Koha::SearchEngine::Elasticsearc::Search->json2marc, it assumes that the MARC::Field constructor always takes >= 5 parameters. This assumption is wrong for control fields, to create a control field you need to call the constructor with: MARC::Field->new($tag, $value); Note that I got "Too much data for control field" in the _warning value of my MARC::Field because too many parameters were passed, and the value was undef. That broke the result search links (on the staff interface) for DB with biblio.biblionumber mapped with 001. Other bugs will certainly be fixed by this patch. For instance I got: GetMarcBiblio called with undefined biblionumber at /home/koha/src/opac/opac-search.pl line 664. GetCOinSBiblio called with undefined record at /home/koha/src/opac/opac-search.pl line 665. in my logs, with this patch I don't get them anymore. Test plan: You can try to recreate the different issues and confirm than this patch fixes them. Or just run the tests Signed-off-by: Nick Clemens <nick@bywatersolutions.com> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Thanks Jonathan, all works as expected, passing QA
Pushed to master for 16.11, thanks Jonathan!
Pushed to 16.05.x, will be in 16.05.06