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 <galen.charlton@liblime.com>
This commit is contained in:
parent
2f5a28ee6a
commit
e805deb7ef
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue