Bug 15209 Validate passed MARC::Record objs in C4::Koha
authorColin Campbell <colin.campbell@ptfs-europe.com>
Wed, 18 Nov 2015 14:53:58 +0000 (14:53 +0000)
committerJulian Maurice <julian.maurice@biblibre.com>
Fri, 29 Jan 2016 10:35:48 +0000 (11:35 +0100)
commit958985b2ff7304cc55a620e0cd1f09d31d213463
treea28695bf2e95eb3ac0d2e15f907cb92bf0f2c01d
parentb94fc3419dc04d06d7557753cea619633ab4c8dd
 Bug 15209 Validate passed MARC::Record objs in C4::Koha

Ensure that a passed MARC::Record is defined before calling
its methods. Otherwise you are open to occurences of the
error 'Can't call method "field" on an undefined value'
In a CGI environment you can live with such sloppiness but
in a persistent environment the error can cause the instance
to abort.
Made all routines passed a MARC::Record validate it before calling
its methods. Changed the parameter name from the meaningless
record to marcrecord to indicate its content. Added an explicit return
for all cases where no valid data returned. Cleaned up some logic for
clarity. I think we can assume that GetNormalizedOCLCNumber meant to
look at all 035s till it found an OCLC number not just the first.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Brendan A Gallagher <brendan@bywatersolutions.com>
(cherry picked from commit 960458dee4a9c09506f48fa73950c0e2da3611e7)
Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>
C4/Koha.pm