Bug 10066 - updating biblio return undefined error if linked authority does not exist in db
Summary: updating biblio return undefined error if linked authority does not exist in db
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: MARC Authority data support (show other bugs)
Version: unspecified
Hardware: All All
: P5 - low major (vote)
Assignee: Galen Charlton
QA Contact:
URL:
Keywords:
: 9110 (view as bug list)
Depends on:
Blocks:
 
Reported: 2013-04-16 16:22 UTC by jb
Modified: 2020-11-30 21:45 UTC (History)
2 users (show)

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description jb 2013-04-16 16:22:29 UTC
descrption of problem:
updating biblio return undefined error if previouly linked authority does not exist in db

steps to recreate:
1. link an authority to biblio
2. manually delete authority from db
3. either a. run link_bibs_to_authorities.pl
   or     b. update the biblio from staff client
4. will return undefined error for field

we wanted to clear all linked authorities subfield $9 from biblios. run into this error. fixed the code, but dont really know if it is the best approach. attaching code fix for reference.

#########################################################################

AuthoritiesMarc.pm
line 1194 added one line: return unless defined($record);

} else {
#fix undefined error if authorized heading does not exist in db
        return unless defined($record);
#
        foreach my $field ($record->field('1..')) {

##########################################################################

Biblio.pm
line 669 added one line: return unless defined($authorized_heading);

    my $authorized_heading =
      C4::AuthoritiesMarc::GetAuthorizedHeading( { 'authid' => $authid } );

#fix undefined error if authorized heading does not exist in db
   return unless defined($authorized_heading);
#

   return ($field->as_string('abcdefghijklmnopqrstuvwxyz') eq $authorized_heading);
Comment 1 Katrin Fischer 2014-09-01 12:06:20 UTC
*** Bug 9110 has been marked as a duplicate of this bug. ***
Comment 2 Jonathan Druart 2016-08-16 09:26:55 UTC
Looking at the code, this is still valid.
Comment 3 Jonathan Druart 2019-12-16 10:08:10 UTC
1. link an authority to biblio
2. manually delete authority from db
3. update the biblio from staff client

=> No crash

Closing, please reopen with updated steps to recreate the problem if still valid.