[Koha-patches] [PATCH 7/8] bulkmarcimport.pl Minor fixes
paul.poulain at biblibre.com
paul.poulain at biblibre.com
Wed Jan 19 21:56:01 CET 2011
From: Henri-Damien LAURENT <henridamien.laurent at biblibre.com>
Testing existence of isbn before using it
Testing existence of data before printing in printlog
Adding debugs
---
misc/migration_tools/bulkmarcimport.pl | 11 +++++++----
1 files changed, 7 insertions(+), 4 deletions(-)
diff --git a/misc/migration_tools/bulkmarcimport.pl b/misc/migration_tools/bulkmarcimport.pl
index 2475f61..f114f9d 100755
--- a/misc/migration_tools/bulkmarcimport.pl
+++ b/misc/migration_tools/bulkmarcimport.pl
@@ -261,9 +261,11 @@ RECORD: while ( ) {
if ($biblios) {
if ($marcFlavour eq 'UNIMARC') {
if (my $f010 = $record->field('010')) {
- $isbn = $f010->subfield('a');
- $isbn =~ s/-//g;
- $f010->update('a' => $isbn);
+ if ($f010->subfield('a')){
+ $isbn = $f010->subfield('a');
+ $isbn =~ s/-//g;
+ $f010->update('a' => $isbn);
+ }
}
} else {
if (my $f020 = $record->field('020')) {
@@ -282,6 +284,7 @@ RECORD: while ( ) {
require C4::Search;
my $query=build_query($match,$record);
my $server=($authorities?'authorityserver':'biblioserver');
+ $debug && warn $query;
my ($error, $results,$totalhits)=C4::Search::SimpleSearch( $query, 0, 3, [$server] );
die "unable to search the database for duplicates : $error" if (defined $error);
$debug && warn "$query $server : $totalhits";
@@ -544,7 +547,7 @@ sub report_item_errors {
}
sub printlog{
my $logelements=shift;
- print $loghandle join (";",@$logelements{qw<id op status>}),"\n";
+ print $loghandle join (";",map{defined $_?$_:""}@$logelements{qw<id op status>}),"\n";
}
--
1.7.1
More information about the Koha-patches
mailing list