Bug 7252 - Lists inaccessible when one or more MARC records listed have been deleted
Summary: Lists inaccessible when one or more MARC records listed have been deleted
Alias: None
Product: Koha
Classification: Unclassified
Component: Lists (show other bugs)
Version: Main
Hardware: All All
: P5 - low normal (vote)
Assignee: Galen Charlton
QA Contact:
Depends on:
Blocks: 8149
  Show dependency treegraph
Reported: 2011-11-22 20:44 UTC by Owen Leonard
Modified: 2015-06-04 23:24 UTC (History)
1 user (show)

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


Note You need to log in before you can comment on or make changes to this bug.
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.