From aa9126803c1f358bf33745fcc12d4f2892089d92 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 Signed-off-by: Henri-Damien LAURENT --- tools/export.pl | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tools/export.pl b/tools/export.pl index 573859ae55..0a3eeacb0b 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 @@ -126,7 +126,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', '' ); @@ -143,6 +143,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.20.1