Bug 12243 - Records with invalid ISBNs can cause searches to fail
Summary: Records with invalid ISBNs can cause searches to fail
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Architecture, internals, and plumbing (show other bugs)
Version: Main
Hardware: All All
: P5 - low critical (vote)
Assignee: Galen Charlton
QA Contact: Kyle M Hall
URL:
Keywords:
Depends on: 10500
Blocks:
  Show dependency treegraph
 
Reported: 2014-05-13 11:17 UTC by Kyle M Hall
Modified: 2019-06-27 09:24 UTC (History)
1 user (show)

See Also:
Change sponsored?: ---
Patch complexity: Trivial patch
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:


Attachments
Bug 12243 - Records with invalid ISBNs can cause searches to fail (1.46 KB, patch)
2014-05-13 11:22 UTC, Kyle M Hall
Details | Diff | Splinter Review
Bug 12243 - Records with invalid ISBNs can cause searches to fail (1.51 KB, patch)
2014-05-14 07:36 UTC, Chris Cormack
Details | Diff | Splinter Review
Bug 12243 - Records with invalid ISBNs can cause searches to fail (1.57 KB, patch)
2014-05-14 08:13 UTC, Jonathan Druart
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Kyle M Hall 2014-05-13 11:17:57 UTC
Some types of invalid ISBNs, when run throught C4::Koha::NormalizeISBN can produce ISBN objects that contain invalid ISBNs. This can be reproduced with an ISBN that has an invalid prefix, group code or publisher code. An example ISBN would be "0788893777 (2 DVD 45th ed)".

When attempting to look up a record with such an ISBN, you will get an error along the lines of: Can't call method "as_string" on an undefined value

Instead of checking for the BAD_ISBN state, we should be checking for the GOOD_ISBN state vi the method is_valid.
Comment 1 Kyle M Hall 2014-05-13 11:22:49 UTC Comment hidden (obsolete)
Comment 2 Chris Cormack 2014-05-14 07:36:40 UTC Comment hidden (obsolete)
Comment 3 Jonathan Druart 2014-05-14 08:13:23 UTC
Created attachment 28244 [details] [review]
Bug 12243 - Records with invalid ISBNs can cause searches to fail

Some types of invalid ISBNs, when run throught C4::Koha::NormalizeISBN
can produce ISBN objects that contain invalid ISBNs. This can be
reproduced with an ISBN that has an invalid prefix, group code or
publisher code. An example ISBN would be "0788893777 (2 DVD 45th ed)".

When attempting to look up a record with such an ISBN, you will get an
error along the lines of: Can't call method "as_string" on an undefined
value

Instead of checking for the BAD_ISBN state, we should be checking for
the GOOD_ISBN state vi the method is_valid.

Test Plan:
1) Edit a record, add the following ISBN to your record: 0788893777 (2 DVD 45th ed)
2) When Koha redirects to the record, you should see the error message described
3) Apply this patch
4) Reload the page, you should now see your record

Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>

Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Comment 4 Galen Charlton 2014-05-19 15:44:25 UTC
Pushed to master.  Thanks, Kyle!