Bug 7252

Summary: Lists inaccessible when one or more MARC records listed have been deleted
Product: Koha Reporter: Owen Leonard <oleonard>
Component: ListsAssignee: Galen Charlton <gmcharlt>
Status: CLOSED FIXED QA Contact:
Severity: normal    
Priority: P5 - low CC: magnus
Version: Main   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: ---
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Bug Depends on:    
Bug Blocks: 8149    

Description Owen Leonard 2011-11-22 20:44:56 UTC
If you delete a title which is on someone's list, that list can no longer be accessed because of an error:

Can't call method "field" on an undefined value at C4/Koha.pm line 1217.

The line in question is part of GetNormalizedUPC:

        @fields = $record->field('024');

Called by VirtualShelves/Page.pm:


       $this_item->{'normalized_upc'}  = GetNormalizedUPC($record,$marcflavour);

Seems like there's several things that can be done here:

1. Remove titles from lists when they are deleted. The disadvantage here is that someone might have been using a list as a bibliography, for instance, and losing the title makes their information incomplete. To follow up:

2. Add error handling to VirtualShelves/Page.pm. Don't try to pull the full MARC data for a biblionumber which doesn't exist. Some choices for the display:

  a. Pretend nothing happened, title never existed
  b. Indicate that a title was removed, no information available.
  c. Indicate that a title was removed, pull basic info from deletedbiblio.

3. Add error handling to Koha.pm. Don't die if an empty record gets passed. This seems like a no-brainer.
Comment 1 Owen Leonard 2011-11-23 15:34:17 UTC
In the OPAC the error occurs only when OPACXSLTResultsDisplay is turned off ("Show biblio records on OPAC result page _normally_"). In the staff client the error occurs no matter what your XSLT display settings are.
Comment 2 Owen Leonard 2014-07-16 12:47:36 UTC
This bug no longer appears in master.