[Koha-bugs] [Bug 10756] Carousel Display of New Titles on OPAC home page

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Wed May 4 09:07:08 CEST 2016


https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=10756

--- Comment #11 from Magnus Enger <magnus at libriotech.no> ---
Created attachment 51177
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=51177&action=edit
Bug 10756 - Carousel Display - Followup

On first testing this I got a 500 error saying "Can't call method
"is_valid" on an undefined value at
/home/magnus/scripts/kohaclone/Koha/Carousel.pm
line 128." This was caused by a record with an ISBN of "979-10-91414-01-2".
The relevant code looks like this:
    my $isbn_obj = Business::ISBN->new($ii);
    my $isbn10;
    $isbn10 = $isbn_obj->as_isbn10;
    if ( $isbn10->is_valid() ) {...}
The documentation for Business::ISBN::as_isbn10 says: "Returns a new
ISBN object. If the object is already ISBN-10, this method clones it.
If it is an ISBN-13 with the prefix 978, it returns the ISBN-10
equivalent. For all other cases it returns undef." So for an ISBN that
starts with 979 like mine did, $isbn10 will be undef and we need to do
some extra checking before is_valid().

To test:
- Apply the first two patches on this bug and follow their test plan
- Make sure you have a new record with an ISBN that starts with 979
- Refresh the front page and observe the error
- Apply this patch
- Refresh the front page again and notice the absence of the error

-- 
You are receiving this mail because:
You are watching all bug changes.


More information about the Koha-bugs mailing list