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)
committerBrendan A Gallagher <brendan@bywatersolutions.com>
Wed, 27 Jan 2016 02:07:20 +0000 (02:07 +0000)
commit960458dee4a9c09506f48fa73950c0e2da3611e7
tree6962a060f73d69e9b2cbb0f4da1d277b21c2663c
parentdcce65c8fd6f6d4963a3dd0e8b73a79548a2aa8b
 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>
C4/Koha.pm