From e805deb7efd1ba7908e91948e8a094675628e576 Mon Sep 17 00:00:00 2001 From: Chris Catalfo Date: Fri, 1 May 2009 23:34:43 +0000 Subject: [PATCH] bug 1907 Partial fix: prevent bad records from truncating output. This patch starts improving export.pl by adding warnings, skipping invalid records, and not trying to access fields which don't exist. Signed-off-by: Galen Charlton --- tools/export.pl | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tools/export.pl b/tools/export.pl index b0cf6beaea..5f0a00adff 100755 --- a/tools/export.pl +++ b/tools/export.pl @@ -18,7 +18,7 @@ use strict; - +use warnings; use C4::Auth; use C4::Output; # contains gettemplate use C4::Biblio; # GetMarcBiblio GetXmlBiblio @@ -128,7 +128,7 @@ if ($op eq "export") { while (my ($biblionumber) = $sth->fetchrow) { my $record = GetMarcBiblio($biblionumber); - + next if not defined $record; if ( $dont_export_items || $strip_nonlocal_items || $limit_ind_branch) { my ( $homebranchfield, $homebranchsubfield ) = GetMarcFromKohaField( 'items.homebranch', '' ); @@ -145,6 +145,8 @@ if ($op eq "export") { /^(\d*)(\w)?$/; my $field = $1; my $subfield = $2; + # skip if this record doesn't have this field + next if not defined $record->field($field); if( $subfield ) { $record->field($field)->delete_subfields($subfield); } -- 2.39.5