Bug 11412: fix potential bulkmarcimport crash when searching for duplicates in authorities

bulkmarcimport.pl can crash when searching for duplicates if the 005
field from the incoming or local record is not defined. This patch
fixes it.

Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>

Test plan
1/ Create a record with no 005 field
2/ Try to import it checking for duplicates, notice it crashes
3/ Try with a record with a 005 field, but the one in Koha missing
one, still crashes
4/ Apply patch
5/ No more crash

Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Passes all tests and QA script.
Patch fixes the problem described for importing authorities
with the bulkmarcimport.pl when trying to match with existing
records.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
(cherry picked from commit 28d97e3228)
Signed-off-by: Fridolin SOMERS <fridolin.somers@biblibre.com>
This commit is contained in:
Matthias Meusburger 2013-12-18 11:20:05 +01:00 committed by Fridolin SOMERS
parent 202f1a4c27
commit 16df6d7504
1 changed files with 3 additions and 1 deletions

View File

@ -245,7 +245,9 @@ RECORD: while ( ) {
$id = GetRecordId( $marcrecord, $tagid, $subfieldid );
if ( $authorities && $marcFlavour ) {
#Skip if authority in database is the same as the on in database
if ( $marcrecord->field('005')->data >= $record->field('005')->data ) {
if ( $marcrecord->field('005') && $record->field('005') &&
$marcrecord->field('005')->data && $record->field('005')->data &&
$marcrecord->field('005')->data >= $record->field('005')->data ) {
if ($yamlfile) {
$yamlhash->{$originalid}->{'authid'} = $id;