From 9359fccf59b0c5c24b02e39570b4989f032acfb8 Mon Sep 17 00:00:00 2001 From: Pierre-Marc Thibault Date: Mon, 25 Feb 2019 13:10:28 -0500 Subject: [PATCH] Bug 22410: Skip normalizing author if the author is undefined Since a record can have a defined author or not and the code needs it at some point, a condition has been added. It verifies if records have an defined author (tag 100). If it's the case, the author is normalized. If not, that is skipped. Test plan: 1) Set the system preference z3950NormalizeAuthor at Copy. 2) Have at least one tag in the field. 3) Have a MARC file with at least 2 records without tag 100. They don't have to be in the same file. 4) Go to Tools > Stage MARC records for import. 5) Stage your file with the character encoding: MARC 8. 4) Go to Acquisitions and add an order to a basket from a staged file. 5) Click on "Add orders" from your file. 6) Click on "Add order" for a record. 7) Software error occurs. 8) Apply patch. 9) Click on "Add order" for another record. 10) Software error doesn't occur. --- acqui/neworderempty.pl | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/acqui/neworderempty.pl b/acqui/neworderempty.pl index 9ca2b5b..ee1e143 100755 --- a/acqui/neworderempty.pl +++ b/acqui/neworderempty.pl @@ -521,7 +521,8 @@ sub MARCfindbreeding { else { # normalize author : probably UNIMARC specific... if ( C4::Context->preference("z3950NormalizeAuthor") - and C4::Context->preference("z3950AuthorAuthFields") ) + and C4::Context->preference("z3950AuthorAuthFields") + and $record->field(GetMarcFromKohaField("biblio.author")) ) { my ( $tag, $subfield ) = GetMarcFromKohaField("biblio.author", ''); -- 2.7.4