[Bug 29437] New: 500 error when performing a catalog search for an ISBN13 with no valid ISBN10
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29437 Bug ID: 29437 Summary: 500 error when performing a catalog search for an ISBN13 with no valid ISBN10 Change sponsored?: --- Product: Koha Version: master Hardware: All OS: All Status: NEW Severity: normal Priority: P5 - low Component: Cataloging Assignee: koha-bugs@lists.koha-community.org Reporter: nick@bywatersolutions.com QA Contact: testopia@bugs.koha-community.org CC: m.de.rooy@rijksmuseum.nl When performing a cataloging search we take the query and test to see if it is a valid isbn: If not, we perform a SQL search for the term as author or title If so, we pass it to BreedingSearch as an ISBN - we then normailize it to ISBN 10 - then perform aSQL search for ISBN In the ISBN case, if it cannot be converted to a 10 digit ISBN we nullify the term - the SQL then has no where statement and fails in plack-error.log: 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 near '' at line 5 at /kohadevbox/koha/cataloguing/addbooks.pl line 117 -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29437 Nick Clemens <nick@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |Needs Signoff Patch complexity|--- |Small patch -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29437 --- Comment #1 from Nick Clemens <nick@bywatersolutions.com> --- Created attachment 127458 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=127458&action=edit Bug 29437: Search reservoir for term as title, author, or variations of ISBN The code in the script and the module attempt to determine whether a term is an isbn, or not. Rather than try to do this, we can simply search it on the three fields: isbn, title, author Additionally, we should search as any of the ISBN variations to broaden our matches Note: Curently only an ISBN 10 is stored in import biblios, so for an ISBN13 that doesn't convert the value will be blank - this is another bug To test: 1 - Perform a cataloging search for a valid ISBN 13 with no ISBN10 counterpart: 9798200834976 2 - 500 error 3 - Apply patch 4 - Repeat, no results 5 - Import some records 6 - Search by title/author/isbn 7 - Confirm searching works as expected -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29437 Nick Clemens <nick@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Assignee|koha-bugs@lists.koha-commun |nick@bywatersolutions.com |ity.org | Depends on| |29319 --- Comment #2 from Nick Clemens <nick@bywatersolutions.com> --- Needs unit tests for QA, but can be tested Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29319 [Bug 29319] Errors when doing a cataloging search which starts with a number + letter -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29437 Nick Clemens <nick@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- See Also| |https://bugs.koha-community | |.org/bugzilla3/show_bug.cgi | |?id=29438 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29437 David Nind <david@davidnind.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Needs Signoff |Signed Off -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29437 David Nind <david@davidnind.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #127458|0 |1 is obsolete| | --- Comment #3 from David Nind <david@davidnind.com> --- Created attachment 127460 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=127460&action=edit Bug 29437: Search reservoir for term as title, author, or variations of ISBN The code in the script and the module attempt to determine whether a term is an isbn, or not. Rather than try to do this, we can simply search it on the three fields: isbn, title, author Additionally, we should search as any of the ISBN variations to broaden our matches Note: Curently only an ISBN 10 is stored in import biblios, so for an ISBN13 that doesn't convert the value will be blank - this is another bug To test: 1 - Perform a cataloging search for a valid ISBN 13 with no ISBN10 counterpart: 9798200834976 2 - 500 error 3 - Apply patch 4 - Repeat, no results 5 - Import some records 6 - Search by title/author/isbn 7 - Confirm searching works as expected Signed-off-by: David Nind <david@davidnind.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29437 David Nind <david@davidnind.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Signed Off |Needs Signoff CC| |david@davidnind.com --- Comment #4 from David Nind <david@davidnind.com> --- (In reply to Nick Clemens from comment #2)
Needs unit tests for QA, but can be tested
Changed status back to needs signoff - everything work as per the test plan. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29437 Nick Clemens <nick@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Needs Signoff |Signed Off -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29437 --- Comment #5 from Nick Clemens <nick@bywatersolutions.com> --- Created attachment 127512 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=127512&action=edit Bug 29437: Unit tests -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29437 Nick Clemens <nick@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #127460|0 |1 is obsolete| | --- Comment #6 from Nick Clemens <nick@bywatersolutions.com> --- Created attachment 127513 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=127513&action=edit Bug 29437: Search reservoir for term as title, author, or variations of ISBN The code in the script and the module attempt to determine whether a term is an isbn, or not. Rather than try to do this, we can simply search it on the three fields: isbn, title, author Additionally, we should search as any of the ISBN variations to broaden our matches Note: Curently only an ISBN 10 is stored in import biblios, so for an ISBN13 that doesn't convert the value will be blank - this is another bug To test: 1 - Perform a cataloging search for a valid ISBN 13 with no ISBN10 counterpart: 9798200834976 2 - 500 error 3 - Apply patch 4 - Repeat, no results 5 - Import some records 6 - Search by title/author/isbn 7 - Confirm searching works as expected WNC amended to fix spelling Signed-off-by: David Nind <david@davidnind.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29437 David Nind <david@davidnind.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #127512|0 |1 is obsolete| | --- Comment #7 from David Nind <david@davidnind.com> --- Created attachment 127516 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=127516&action=edit Bug 29437: Unit tests Signed-off-by: David Nind <david@davidnind.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29437 David Nind <david@davidnind.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #127513|0 |1 is obsolete| | --- Comment #8 from David Nind <david@davidnind.com> --- Created attachment 127517 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=127517&action=edit Bug 29437: Search reservoir for term as title, author, or variations of ISBN The code in the script and the module attempt to determine whether a term is an isbn, or not. Rather than try to do this, we can simply search it on the three fields: isbn, title, author Additionally, we should search as any of the ISBN variations to broaden our matches Note: Curently only an ISBN 10 is stored in import biblios, so for an ISBN13 that doesn't convert the value will be blank - this is another bug To test: 1 - Perform a cataloging search for a valid ISBN 13 with no ISBN10 counterpart: 9798200834976 2 - 500 error 3 - Apply patch 4 - Repeat, no results 5 - Import some records 6 - Search by title/author/isbn 7 - Confirm searching works as expected WNC amended to fix spelling Signed-off-by: David Nind <david@davidnind.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29437 Joonas Kylmälä <joonas.kylmala@iki.fi> changed: What |Removed |Added ---------------------------------------------------------------------------- See Also| |https://bugs.koha-community | |.org/bugzilla3/show_bug.cgi | |?id=17979 CC| |joonas.kylmala@iki.fi -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29437 David Cook <dcook@prosentient.com.au> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |dcook@prosentient.com.au -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29437 Jonathan Druart <jonathan.druart+koha@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |rel_21_05_candidate, | |rel_21_11_candidate CC| |jonathan.druart+koha@gmail. | |com -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29437 Marcel de Rooy <m.de.rooy@rijksmuseum.nl> changed: What |Removed |Added ---------------------------------------------------------------------------- QA Contact|testopia@bugs.koha-communit |m.de.rooy@rijksmuseum.nl |y.org | Status|Signed Off |BLOCKED --- Comment #9 from Marcel de Rooy <m.de.rooy@rijksmuseum.nl> --- QAing -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29437 Marcel de Rooy <m.de.rooy@rijksmuseum.nl> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|BLOCKED |Passed QA -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29437 Marcel de Rooy <m.de.rooy@rijksmuseum.nl> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #127516|0 |1 is obsolete| | --- Comment #10 from Marcel de Rooy <m.de.rooy@rijksmuseum.nl> --- Created attachment 127842 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=127842&action=edit Bug 29437: Unit tests Signed-off-by: David Nind <david@davidnind.com> Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29437 Marcel de Rooy <m.de.rooy@rijksmuseum.nl> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #127517|0 |1 is obsolete| | --- Comment #11 from Marcel de Rooy <m.de.rooy@rijksmuseum.nl> --- Created attachment 127843 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=127843&action=edit Bug 29437: Search reservoir for term as title, author, or variations of ISBN The code in the script and the module attempt to determine whether a term is an isbn, or not. Rather than try to do this, we can simply search it on the three fields: isbn, title, author Additionally, we should search as any of the ISBN variations to broaden our matches Note: Curently only an ISBN 10 is stored in import biblios, so for an ISBN13 that doesn't convert the value will be blank - this is another bug To test: 1 - Perform a cataloging search for a valid ISBN 13 with no ISBN10 counterpart: 9798200834976 2 - 500 error 3 - Apply patch 4 - Repeat, no results 5 - Import some records 6 - Search by title/author/isbn 7 - Confirm searching works as expected WNC amended to fix spelling Signed-off-by: David Nind <david@davidnind.com> Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> AMENDED: Useless call of ISBNs (plural) when you only pass one parameter. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29437 --- Comment #12 from Marcel de Rooy <m.de.rooy@rijksmuseum.nl> --- Created attachment 127844 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=127844&action=edit Bug 29437: (QA follow-up) Remove Business::ISBN from addbooks Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29437 --- Comment #13 from Marcel de Rooy <m.de.rooy@rijksmuseum.nl> --- Created attachment 127845 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=127845&action=edit Bug 29437: (QA follow-up) Update TODO in Breeding.t We now have some tests for BreedingSearch. Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29437 --- Comment #14 from Marcel de Rooy <m.de.rooy@rijksmuseum.nl> --- (In reply to David Nind from comment #8)
Note: Curently only an ISBN 10 is stored in import biblios, so for an ISBN13 that doesn't convert the value will be blank - this is another bug
Did you open a new report ? -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29437 --- Comment #15 from Marcel de Rooy <m.de.rooy@rijksmuseum.nl> --- Looks good enough to me. A funny side effect is that we find reservoir books via the ISBN variations 10/13/hypens/no hyphens. We wont find them in the catalog. But if we search for a partial isbn 545 (as being part of eg 0-545-01022-5), we will not find anything in the reservoir, but Zebra finds it in the catalog. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29437 Jonathan Druart <jonathan.druart+koha@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Passed QA |Pushed to master Version(s)| |21.11.00 released in| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29437 --- Comment #16 from Jonathan Druart <jonathan.druart+koha@gmail.com> --- Pushed to master for 21.11, thanks to everybody involved! -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29437 Kyle M Hall <kyle@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Pushed to master |Pushed to stable Version(s)|21.11.00 |21.11.00,21.05.05 released in| | CC| |kyle@bywatersolutions.com --- Comment #17 from Kyle M Hall <kyle@bywatersolutions.com> --- Pushed to 21.05.x for 21.05.05 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29437 Fridolin Somers <fridolin.somers@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |fridolin.somers@biblibre.co | |m --- Comment #18 from Fridolin Somers <fridolin.somers@biblibre.com> --- Depends on Bug 29319 not in 20.11.x -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29437 Jonathan Druart <jonathan.druart+koha@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords|rel_21_05_candidate, | |rel_21_11_candidate | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29437 --- Comment #19 from Nick Clemens <nick@bywatersolutions.com> --- *** Bug 17979 has been marked as a duplicate of this bug. *** -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29437 --- Comment #20 from Marcel de Rooy <m.de.rooy@rijksmuseum.nl> --- (In reply to Fridolin Somers from comment #18)
Depends on Bug 29319 not in 20.11.x
Actually a pity that we didnt backport something. Quite easy to generate this in the logs: [2021/12/08 15:49:20] [WARN] 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 near '' 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 /usr/share/koha/C4/Breeding.pm line 100. [2021/12/08 15:49:20] [WARN] DBD::mysql::st fetchrow_hashref failed: fetch() without execute() [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 /usr/share/koha/C4/Breeding.pm line 101. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29437 --- Comment #21 from Marcel de Rooy <m.de.rooy@rijksmuseum.nl> --- This is the most minimal maintenance solution I could come up with for 20.11: diff --git a/C4/Breeding.pm b/C4/Breeding.pm index 6b103b3..5b0d83a 100644 --- a/C4/Breeding.pm +++ b/C4/Breeding.pm @@ -96,6 +96,7 @@ sub BreedingSearch { $query .= "isbn like ?"; push(@bind,"$isbn%"); } + return 0 unless @bind; $sth = $dbh->prepare($query); $sth->execute(@bind); while (my $data = $sth->fetchrow_hashref) { Since Koha returns a 200, it only gives you a few log lines less. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29437 Victor Grousset/tuxayo <victor@tuxayo.net> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |victor@tuxayo.net --- Comment #22 from Victor Grousset/tuxayo <victor@tuxayo.net> --- Hi, I'll try to backport this for 20.11. Thanks Marcel for digging into this, how should this change be used? How can I use it to solve the conflicts due to bug 29319 missing? Or maybe it's a whole alternative patch? Another way: does bug 29319 seems like a risky backport to you? The odd thing is that I can catalogue search stuff that begins with digits without getting errors. In other words, I don't reproduce the issue. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29437 --- Comment #23 from Marcel de Rooy <m.de.rooy@rijksmuseum.nl> --- (In reply to Victor Grousset/tuxayo from comment #22)
Hi, I'll try to backport this for 20.11.
Thanks Marcel for digging into this, how should this change be used? How can I use it to solve the conflicts due to bug 29319 missing? Or maybe it's a whole alternative patch?
Another way: does bug 29319 seems like a risky backport to you? The odd thing is that I can catalogue search stuff that begins with digits without getting errors. In other words, I don't reproduce the issue.
29319 seems quite innocent to me -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29437 Victor Grousset/tuxayo <victor@tuxayo.net> changed: What |Removed |Added ---------------------------------------------------------------------------- Version(s)|21.11.00,21.05.05 |21.11.00,21.05.05,20.11.14 released in| | Status|Pushed to stable |Pushed to oldstable --- Comment #24 from Victor Grousset/tuxayo <victor@tuxayo.net> --- Backported: Pushed to 20.11.x branch for 20.11.14 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29437 Victor Grousset/tuxayo <victor@tuxayo.net> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Pushed to oldstable |Pushed to oldoldstable -- You are receiving this mail because: You are watching all bug changes.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org