From c61958df9557e4a8dc5f39d304cb6e9f32681d1f Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Fri, 9 Apr 2021 14:19:43 +0200 Subject: [PATCH] Bug 17979: Fix cataloguing search if ISBN 13 is passed This patch fixes the following error: C4::Breeding::BreedingSearch(): DBI Exception: DBD::mysql::st execute failed: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use ne ar '' at line 5 [for Statement "SELECT import_record_id, file_name, isbn, title, author FROM import_biblios JOIN import_records USING (import_record_id) JOIN import_batches USING (import_batch_id) WHERE "] at /kohadevbox/koha/cataloguing/addbooks.pl line 126 at /usr/share/perl5/DBIx/Class/Exception.pm line 77 It happens when our GetNormalizedISBN sub does not return an ISBN, the SQL query generated by BreedingSearch is invalid Test plan: Try a cataloguing search with "400638133393x" --- C4/Breeding.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/C4/Breeding.pm b/C4/Breeding.pm index 2a4ce3c2acc..fe764cfd890 100644 --- a/C4/Breeding.pm +++ b/C4/Breeding.pm @@ -76,7 +76,7 @@ sub BreedingSearch { my @results; # normalise ISBN like at import - $isbn = C4::Koha::GetNormalizedISBN($isbn); + $isbn = C4::Koha::GetNormalizedISBN($isbn) || $isbn; $query = "SELECT import_record_id, file_name, isbn, title, author FROM import_biblios -- 2.20.1